示例#1
0
 // Use this for initialization
 void Start()
 {
     rrand              = Random.Range(0, 100);
     food_hold          = 0;
     last_hunger        = Time.time;
     last_action        = Time.time;
     last_sleep         = Time.time + Random.Range(0, sleep_interval);
     last_mating        = Time.time + Random.Range(mating_cooldown / 2, mating_cooldown);
     nextNode           = mySquare;
     currentDestination = mySquare;
     wg = GameObject.FindGameObjectWithTag("world").GetComponent <WorldGen>();
     wl = GameObject.FindGameObjectWithTag("world").GetComponent <WorldLogic>();
     rf = gameObject.GetComponent <RabbitFinder>();
     rm = gameObject.GetComponent <RabbitMover>();
     ng = gameObject.GetComponent <NameGen>();
     rm.SetPosition(wg.VertexToVector3(mySquare));
     anim = gameObject.GetComponent <Animator>();
     ng   = gameObject.GetComponent <NameGen>();
     //initiate rabbit stats
     myname = ng.getName();
     hp     = 20;
     maxhp  = 20;
     hunger = 7;
     full   = 10;
     str    = Random.Range(1, 4);
     spd    = Random.Range(1, 4);
     speed  = 1 / (float)spd;
     if (!starting_rabbit)
     {
         profession = "Guard";
         sex        = Random.Range(0, 2);
     }
 }
示例#2
0
文件: Ferret.cs 项目: 9volt/ld29
 // Use this for initialization
 void Start()
 {
     next_node = pos;
     hp = maxhp;
     last_action = Time.time;
     wg = GameObject.FindGameObjectWithTag("world").GetComponent<WorldGen>();
     wl = GameObject.FindGameObjectWithTag("world").GetComponent<WorldLogic>();
     rf = gameObject.GetComponent<RabbitFinder>();
     rm = gameObject.GetComponent<RabbitMover>();
     rm.SetPosition(wg.VertexToVector3(pos));
     Camera.main.gameObject.GetComponent<CameraMove>().SetPosition(pos);
 }
示例#3
0
文件: Enemy.cs 项目: 9volt/ld29
 // Use this for initialization
 void Start()
 {
     next_node   = pos;
     hp          = maxhp;
     last_action = Time.time;
     wg          = GameObject.FindGameObjectWithTag("world").GetComponent <WorldGen>();
     rf          = gameObject.GetComponent <RabbitFinder>();
     rm          = gameObject.GetComponent <RabbitMover>();
     anim        = gameObject.GetComponent <Animator>();
     rm.SetPosition(wg.VertexToVector3(pos));
     Camera.main.gameObject.GetComponent <CameraMove>().SetPosition(pos);
 }
示例#4
0
文件: RabbitLogic.cs 项目: 9volt/ld29
 // Use this for initialization
 void Start()
 {
     rrand = Random.Range(0, 100);
     food_hold = 0;
     last_hunger = Time.time;
     last_action = Time.time;
     last_sleep = Time.time + Random.Range(0, sleep_interval);
     last_mating = Time.time + Random.Range(mating_cooldown/2, mating_cooldown);
     nextNode = mySquare;
     currentDestination = mySquare;
     wg = GameObject.FindGameObjectWithTag("world").GetComponent<WorldGen>();
     wl = GameObject.FindGameObjectWithTag("world").GetComponent<WorldLogic>();
     rf = gameObject.GetComponent<RabbitFinder>();
     rm = gameObject.GetComponent<RabbitMover>();
     ng = gameObject.GetComponent<NameGen>();
     rm.SetPosition(wg.VertexToVector3(mySquare));
     anim = gameObject.GetComponent<Animator>();
     ng = gameObject.GetComponent<NameGen>();
     //initiate rabbit stats
     myname = ng.getName();
     hp = 20;
     maxhp = 20;
     hunger = 7;
     full = 10;
     str = Random.Range(1,4);
     spd = Random.Range(1,4);
     speed = 1 / (float)spd;
     if(!starting_rabbit){
         profession = "Guard";
         sex = Random.Range(0,2);
     }
 }