Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     if (Application.isEditor)
     {
         isMobile = false;
     }
     _player = GameObject.Find("Panda").GetComponent <PandaController>();
 }
Beispiel #2
0
 // Method that sets the objects inside the grid
 void instantiate_Level()
 {
     grid_objects = new GameObject[size, size];
     neighbors    = new GameObject[8];
     for (int i = 0; i < neighbors.Length; i++)
     {
         neighbors [i] = null;
     }
     for (int i = 0; i < size; i++)
     {
         for (int j = 0; j < size; j++)
         {
             if (states [i, j] == 1)
             {
                 grid_objects [i, j] = (GameObject)Instantiate(panda_pre, grid [i, j].transform.position, Quaternion.identity);
                 pandaPosition       = new Vector2(i, j);
                 panda               = grid_objects [i, j];
                 panda_Cont          = panda.GetComponent <PandaController> ();
                 panda_Cont.isMoving = false;
                 panda_Cont.target   = grid[i, j].transform;
             }
             else if (states [i, j] == 2)
             {
                 grid_objects [i, j] = (GameObject)Instantiate(flag_pre, grid [i, j].transform.position, Quaternion.identity);
             }
             else if (states [i, j] == 3)
             {
                 grid_objects [i, j] = (GameObject)Instantiate(bamboo_pre, grid [i, j].transform.position, bamboo_pre.transform.rotation);
                 total_bamboo++;
             }
             else
             {
                 grid_objects [i, j] = null;
             }
         }
     }
 }
Beispiel #3
0
 void Hit(PandaController Target)
 {
     Target.Hit(damage);
     Destroy(gameObject);
 }
 // Use this for initialization
 void Start()
 {
     _player = GameObject.Find("Panda").GetComponent <PandaController>();
 }