void FollowMouse() { TowerBTN TB = GameObject.FindObjectOfType <TowerBTN>(); if (TB.spriterender.enabled) { transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition); transform.position = new Vector3(transform.position.x, transform.position.y, 0); AreaRange.transform.localScale = new Vector3(x, y, 1f); } }
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(); }