4-C # Programming in Unity-0 Foundation (Unity)
Print can only be exported within the component. = = "Inherits the Monobehaviour script to use."
Debug.Log ();
Debug.logwarning ();
Debug.logerror ();
Definition of a variable
Data and data types
Http://www.cnblogs.com/tonney/archive/2011/03/18/1987577.html
Operator
Https://wenku.baidu.com/view/93c32317a76e58fafab00341.html
19-Enum Type:
Using System;namespace meiju{ enum roletype { Mag, Soldier, Wizard } Class Program { static void Main (string[] args) { Roletype rt = Roletype.soldier; Console.WriteLine (RT); Console.readkey ();}}}
22-creation, declaration, and construction of classes
Using system.collections;using system.collections.generic;using Unityengine;public class Learncsharp2:monobehaviour { void Start () { int hp = +; A variable declared with a class can be called an object //enemy enemy1 = new Enemy ();//Construct object //enemy enemy1 = null; Print (enemy1); Enemy enemy1 = new Enemy (); Print (enemy1.name); Print (ENEMY1.HP); Enemy1.name = "Mary"; Print (enemy1.name); Enemy enemy2 = new Enemy (); Enemy2.name = "small Two"; Print (Enemy1.name + "-" + enemy2.name); Enemy1. Move (); Enemy2. Move (); }} The field of class Enemy {public string name;//public can access public int hp through the object ; public void Move () { Debug.Log (name + "Moving"); } public void Attack () { Debug.Log ("attacking");} }
First stage: C # Programming in basic 4-unity-0 fundamentals (Unity 2017)