Пример #1
0
 private void SetTowerParams(TowerSettings towerSettings)
 {
     _range         = towerSettings.range;
     _shootInterval = towerSettings.shootInterval;
     _damage        = towerSettings.damage;
     _buildPrice    = towerSettings.buildPrice;
 }
        public void SellTower(TowerSlot selectedTowerSlot)
        {
            TowerSettings towerSettings = SettingsDataUtils.GetTowerSettingsByType(selectedTowerSlot.TowerType);

            _gameManager.PlayerController.ChangeCoinsAmount(towerSettings.buildPrice);
            selectedTowerSlot.SellTower();
        }
        public void BuildTower(TowerSlot selectedTowerSlot, Enumerators.TowerType towerType)
        {
            TowerSettings towerSettings = SettingsDataUtils.GetTowerSettingsByType(towerType);

            _gameManager.PlayerController.ChangeCoinsAmount(-towerSettings.buildPrice);
            selectedTowerSlot.BuildTower(towerType);
        }
Пример #4
0
        private void CreateButton(TowerSettings towerSettings)
        {
            Button button = MonoBehaviour.Instantiate(_buildTowerButtonPrefab, _buildTowerButtonsContainer, false).GetComponent <Button>();

            button.transform.Find("Text_Label").GetComponent <TextMeshProUGUI>().text = towerSettings.towerType + "\n" + "<b>" + towerSettings.buildPrice + "$</b>";
            button.onClick.AddListener(() => OnBuildTowerButtonClickHandler(towerSettings.towerType));
            _buildTowerButtons.Add(new BuildTowerButton(button, towerSettings));
        }
Пример #5
0
        public Tower(Enumerators.TowerType towerType, Transform spawnPoint, Transform container)
        {
            TowerType = towerType;
            _bullets  = new List <Bullet>();

            _gameManager = GameClient.Get <IGameManager>();

            TowerSettings towerSettings = SettingsDataUtils.GetTowerSettingsByType(towerType);

            SetTowerParams(towerSettings);
            SpawnTower(towerSettings.prefab, spawnPoint, container);
        }
Пример #6
0
 public BuildTowerButton(Button button, TowerSettings towerSettings)
 {
     this.button        = button;
     this.towerSettings = towerSettings;
 }