一个类的学习

class Person{
   var name;
   var career;
}
var john = Person();
function update(){
john.name = "John Smith";
john.career = "doctor";
Debug.Log(john.name + " is a " + john.career);
}

--------------------------------------

class ControlDate//定义类
{
    var turnRight:float;
    var  turnLeft:String;
 var stepForward:float;
    var stepBackward:float;
}
private var x:String;
function Awake()
{
  var Pattern= new ControlDate[15];//实例化一个类为15个成员的数组
  for(i=0;i<Pattern.length;i++)
  {
   Pattern[i]= new ControlDate();//实例化成员
   }
   Pattern[0].turnRight =1;
   //Pattern[0].turnLeft =2;
   Pattern[3].turnLeft ="ddgdgdgfd";
  x=Pattern[3].turnLeft;
}

function Update()
{
  print(x);
}

你可能感兴趣的:(学习)