public void TankTowerSelected() { _gameBoard.ClearHighlightTiles(); _tileEventHandler.SelectTowerType(0); _tileEventHandler.SetOperation(1); int[] towerInfo = new int[11]; int range = _towerController.CheckTowerInfo(0, towerInfo); //Debug.Log("Range is " + range + " " + _tileEventHandler.GridX + " " + _tileEventHandler.GridY); _tileEventHandler.DisplayAttackRange(range); _buildCheckPanel.Appear(); _towerInfoPanel.SetTowerInfo(towerInfo); _towerInfoPanel.Appear(); _notificationPanel.SetNotificationType("Tank"); _notificationPanel.Appear(); }
void OnMouseDown() { _gameBoard.ClearHighlightTiles(); _towerInfoPanel.ResetTextColor(); if (_towerExist) { _sellButton.SellOptButton.interactable = true; if (_levelManager.CurrentGamePhase() == GameBoard.GamePhase.BattlePhase) { _sellButton.SellOptButton.interactable = false; } _sellButton.setTowerEventHandler(this); _upgradeButton.setTowerEventHandler(this); _repairButton.setTowerEventHandler(this); _yesButton.setTileEventHandler(this); _towerOperationPanel.Appear(); int[] towerInfo = new int[11]; int[] upgradedTowerInfo = new int[11]; // highlight attack range and if there is enough money to upgrade or repair if (0 == _currentTowerType) { DisplayAttackRange(_tankTowerPtr.GetTowerInfo(towerInfo)); _tankTowerPtr.GetTowerUpgradedInfo(upgradedTowerInfo); _towerInfoPanel.SetTankTower(_tankTowerPtr); if (_tankTowerPtr.UpgradeCost > _levelManager.GetGold()) { _upgradeButton.SetGoldCheckFlag(_tankTowerPtr.UpgradeCost); } if (_tankTowerPtr.IsDestory()) { _upgradeButton.SetDestroyFlag(); } if (_tankTowerPtr.RepairCost > _levelManager.GetGold()) { _repairButton.SetGoldCheckFlag(); } if (_tankTowerPtr.IsFullHealth()) { _repairButton.SetHpCheckFlag(); } } if (1 == _currentTowerType) { DisplayAttackRange(_rangeTowerPtr.GetTowerInfo(towerInfo)); _rangeTowerPtr.GetTowerUpgradedInfo(upgradedTowerInfo); _towerInfoPanel.SetRangeTower(_rangeTowerPtr); if (_rangeTowerPtr.UpgradeCost > _levelManager.GetGold()) { _upgradeButton.SetGoldCheckFlag(_rangeTowerPtr.UpgradeCost); } if (_rangeTowerPtr.IsDestory()) { _upgradeButton.SetDestroyFlag(); } if (_rangeTowerPtr.RepairCost > _levelManager.GetGold()) { _repairButton.SetGoldCheckFlag(); } } if (2 == _currentTowerType) { DisplayAttackRange(_slowTowerPtr.GetTowerInfo(towerInfo)); _slowTowerPtr.GetTowerUpgradedInfo(upgradedTowerInfo); _towerInfoPanel.SetSlowTower(_slowTowerPtr); if (_slowTowerPtr.UpgradeCost > _levelManager.GetGold()) { _upgradeButton.SetGoldCheckFlag(_slowTowerPtr.UpgradeCost); } if (_slowTowerPtr.IsDestory()) { _upgradeButton.SetDestroyFlag(); } if (_slowTowerPtr.RepairCost > _levelManager.GetGold()) { _repairButton.SetGoldCheckFlag(); } } if (3 == _currentTowerType) { DisplayAttackRange(_healTowerPtr.GetTowerInfo(towerInfo)); _healTowerPtr.GetTowerUpgradedInfo(upgradedTowerInfo); _towerInfoPanel.SetHealTower(_healTowerPtr); if (_healTowerPtr.UpgradeCost > _levelManager.GetGold()) { _upgradeButton.SetGoldCheckFlag(_healTowerPtr.UpgradeCost); } if (_healTowerPtr.IsDestory()) { _upgradeButton.SetDestroyFlag(); } if (_healTowerPtr.RepairCost > _levelManager.GetGold()) { _repairButton.SetGoldCheckFlag(); } } if (4 == _currentTowerType) { DisplayAttackRange(_goldTowerPtr.GetTowerInfo(towerInfo)); _goldTowerPtr.GetTowerUpgradedInfo(upgradedTowerInfo); _towerInfoPanel.SetGoldTower(_goldTowerPtr); if (_goldTowerPtr.UpgradeCost > _levelManager.GetGold()) { _upgradeButton.SetGoldCheckFlag(_goldTowerPtr.UpgradeCost); } if (_goldTowerPtr.IsDestory()) { _upgradeButton.SetDestroyFlag(); } if (_goldTowerPtr.RepairCost > _levelManager.GetGold()) { _repairButton.SetGoldCheckFlag(); } } _towerInfoPanel.SetTowerInfo(towerInfo); _towerInfoPanel.SetUpgradedTowerInfo(upgradedTowerInfo); _towerInfoPanel.Appear(); _towerBuildPanel.DisAppear(); _buildCheckPanel.DisAppear(); _notificationPanel.DisAppear(); } else { _gameBoard.HighlightTileAt(GridX, GridY, new Color(0f, 1f, 0.2f, 0.5f)); if (GameBoard.GamePhase.BattlePhase == _gameBoard.CurrentGamePhase) { _gameBoard.ClearHighlightTiles(); _buildCheckPanel.DisAppear(); _towerInfoPanel.DisAppear(); _towerOperationPanel.DisAppear(); _notificationPanel.DisAppear(); return; } _tankTowerButton.setTowerEventHandler(this); _rangeTowerButton.setTowerEventHandler(this); _slowTowerButton.setTowerEventHandler(this); _healTowerButton.setTowerEventHandler(this); _goldTowerButton.setTowerEventHandler(this); _yesButton.setTileEventHandler(this); _towerBuildPanel.Appear(); _towerOperationPanel.DisAppear(); _towerInfoPanel.DisAppear(); _buildCheckPanel.DisAppear(); _notificationPanel.DisAppear(); } }