void OnMouseDown() { if (!IsValid) { return; } if (LevelManager.CanBuyOrUpgrade(LevelManager.CurrentTowerHandler.Settings.Cost) && m_grid.CanPlace(this)) { m_agentPlaced = LevelManager.BuyTower(transform.position, Quaternion.identity); m_renderer.enabled = false; } }
private void ShowPanelUpgrade(TowerSettings settings) { var newCost = settings.CostToUpgrade; var toUpgrade = new TowerSettings { Name = settings.LevelAfterUpgrade, Description = "Increase damage", Cost = newCost, Damage = settings.DamageAfterUpgrade, Range = settings.Range, Speed = settings.Speed }; m_panelUpgrade.Show(toUpgrade); m_upgradeButton.SetActive(LevelManager.CanBuyOrUpgrade(newCost)); }