Exemplo n.º 1
0
 void Spawn()
 {
     if (spawned == false)
     {
         if (openingDirection == 1)
         {
             rand = Random.Range(0, templates.getBottomRoomsLength());
             go   = Instantiate(templates.getBottomRooms(rand), transform.position, Quaternion.identity);
             go.transform.parent = GameObject.Find("Grid").transform;
         }
         else if (openingDirection == 2)
         {
             rand = Random.Range(0, templates.getTopRoomsLength());
             go   = Instantiate(templates.getTopRooms(rand), transform.position, Quaternion.identity);
             go.transform.parent = GameObject.Find("Grid").transform;
         }
         else if (openingDirection == 3)
         {
             rand = Random.Range(0, templates.getLeftRoomsLength());
             go   = Instantiate(templates.getLeftRooms(rand), transform.position, Quaternion.identity);
             go.transform.parent = GameObject.Find("Grid").transform;
         }
         else if (openingDirection == 4)
         {
             rand = Random.Range(0, templates.getRightRoomsLength());
             go   = Instantiate(templates.getRightRooms(rand), transform.position, Quaternion.identity);
             go.transform.parent = GameObject.Find("Grid").transform;
         }
         spawned = true;
     }
 }