private void OnMouseOver() { if (!EventSystem.current.IsPointerOverGameObject() && TowerSpawn.TowerPrefab == null && Input.GetMouseButtonDown(0)) { GameManager GM = GameObject.FindObjectOfType <GameManager>(); Upgrade UP = GameObject.FindObjectOfType <Upgrade>(); UP.DeselectSoldier(); GM.DeselectTower(); } }
void HandleEsc() { Upgrade Up = GameObject.FindObjectOfType <Upgrade>(); if (Input.GetKeyDown(KeyCode.Escape)) { GameManager GM = GameObject.FindObjectOfType <GameManager>(); GM.DeselectTower(); Up.DeselectSoldier(); } }
public void Sell() { if (towerSelect != null) { towerSelect.GetComponentInParent <TileScript>(); Destroy(towerSelect.transform.parent.gameObject); tile.GetComponent <TileScript>(); tile.isEmpty = true; Upgrade UP = GameObject.FindObjectOfType <Upgrade>(); UP.DeselectSoldier(); DeselectTower(); Gold += 50; } }
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(); } } }