Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     //Spawn Level
     levelSpawner = this.GetComponent <LevelSpawner>();
     tileList     = levelSpawner.SpawnTiles(5, 5);
     //Spawn Units
     //Test: Spawn on Tile(3)(1)
     if (GameObject.Find("Tile(3)(1)") != null)
     {
         GameObject spawnOnTile = GameObject.Find("Tile(3)(1)");
         Vector3    position    = new Vector3(spawnOnTile.transform.position.x, unitHeight, spawnOnTile.transform.position.z);
         GameObject tmpUnit     = Instantiate(testUnit, position, Quaternion.identity);
         tmpUnit.GetComponent <Unit> ().Setup(spawnOnTile);
         tmpUnit.GetComponent <Unit> ().OwnedByPlayer = true;
         spawnOnTile.GetComponent <Tile> ().SetUnit(tmpUnit);
     }
     //Disable UI (Cleanup)
     unitControl.SetActive(false);
 }