コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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));
        }