public void DeselectTower() { this._leftOpaque.SetActive(false); this._upgradePanel.SetActive(false); if (this._selectedTower != null) { this._selectedTower.Select(); } this._selectedTower = null; }
public void SelectTower(Tower_script tower) { this._sellText.text = string.Format("SELL: ${0}", (tower.Price / 2)); this._leftOpaque.SetActive(true); this._upgradePanel.SetActive(true); if (this._selectedTower != null) { this._selectedTower.Select(); } this._selectedTower = tower; this._selectedTower.Select(); }
private void PlaceTower() { GameObject tower = (GameObject)Instantiate(Game_script.Instance.ClickedButton.TowerPrefab, this.WorldPosition, Quaternion.identity); tower.GetComponent <SpriteRenderer>().sortingOrder = this.Position.Row; tower.transform.SetParent(this.transform); this._tower = tower.transform.GetChild(0).GetComponent <Tower_script>(); this.IsAvailable = false; this.IsWalkable = false; this._tower.Price = Game_script.Instance.ClickedButton.Price; Game_script.Instance.PurchaseTower(); }
//BuildTower starts here public void BuildTower(GameObject tower, GameObject grid) { GameObject insTower; if (getInwave()) { for (int i = 0; i < route.Count; i++) { GameObject gs = GetGrid(route[i]); if (grid.gameObject.Equals(gs)) { display_info.text = "Can't build on the route during a wave!"; return; } } } if (!getInwave()) { ClearPath(); grid.GetComponent <Grid_script>().setAvailability(false); if (!FindPath()) { display_info.text = "Can't block the only route!"; grid.GetComponent <Grid_script>().setAvailability(true); UpdatePath(); return; } else { UpdatePath(); } } insTower = Instantiate(tower); Tower_script ts = insTower.GetComponent <Tower_script>(); ts.SetPlayer(player); ts.SetMapController(this.gameObject); insTower.GetComponent <Tower_script>().SetGrid(grid); insTower.transform.position = grid.transform.position + new Vector3(0, 1F, 0); player.GetComponent <PlayerController_script>().addCurrentResource(-1 * iconManager.GetComponent <IconManager>().price.GetPrice(tower)); }
public void Initialize(Tower_script parent) { this._parent = parent; this._target = parent.Target; }