Ejemplo n.º 1
0
 public void CreateTower()
 {
     //TextBox.text = "You have selected the " + currTower.name + " Tower. Click on any area of dirt to place the tower.";
     // UIManager.Singleton.UpdateTextBox("You have selected the " + currTower.name + " Tower. Click on any area of dirt to place the tower.");
     //print("create tower: before if clicked");
     if (Input.GetKey(KeyCode.Mouse0))
     {
         Vector3 mouseLoc = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         if (ValidClickedLocation(Input.mousePosition))
         {
             mouseLoc.z = 0f;
             TowerParent tempTower = Instantiate(currTower, mouseLoc, Quaternion.identity);
             tempTower.towerPosition = new Vector3(mouseLoc.x, mouseLoc.y, 0f);
             tempTower.xCoordinate   = mouseLoc.x;
             tempTower.yCoordinate   = mouseLoc.y;
             towerClicked            = false;
             // Path.Singleton.acceptableLocation = true;
             UpdateToOriginalText();
         }
         else
         {
             UIManager.Singleton.UpdateTextBox("Cannot Place Tower here. Pick another spot.");
         }
     }
 }
Ejemplo n.º 2
0
 public void AddTower(TowerParent tower)
 {
     TowersList.Add(tower);
 }