private void OnMouseOver() { GameManager GM = GameObject.FindObjectOfType <GameManager>(); Upgrade Up = GameObject.FindObjectOfType <Upgrade>(); TowerBTN TB = GameObject.FindObjectOfType <TowerBTN>(); colorTile(Color.blue); if (!EventSystem.current.IsPointerOverGameObject() && TowerSpawn.TowerPrefab != null) { if (isEmpty) { colorTile(emptyColor); } if (!isEmpty) { colorTile(fullcolor); } else if (Input.GetMouseButtonDown(0)) { PlaceTower(); GM.Gold -= TowerBTN.Price; TB.DeactivateSprite(); } } else if (!EventSystem.current.IsPointerOverGameObject() && TowerSpawn.TowerPrefab == null && Input.GetMouseButtonDown(0)) { if (mytower != null && mysoldier != null) { GM.SelectTower(mytower, mytile); Up.SelectSoldier(mysoldier); } else { GM.DeselectTower(); Up.DeselectSoldier(); } } }
public static void BuyTower() { TowerBTN TB = GameObject.FindObjectOfType <TowerBTN>(); TB.DeactivateSprite(); }