private void BuyTower(Tower.Tower tower, Collider other)
        {
            _towerManager.PlaceTower(SelectionPlanePosition, tower);
            _playerManager.UpdateCoins(_towerManager.Cannon.GetPrice(), Operator.Subtract);

            MarkAsOccupied(other);
        }
Example #2
0
 private void UpdateTowerInfo(Tower.Tower tower)
 {
     shootSpeedText.text = tower.GetShootSpeed().ToString("0.00");
     damageText.text     = tower.GetDamage().ToString("0.00");
     priceText.text      = tower.GetLevelPrice().ToString();
     levelText.text      = tower.GetLevel().ToString();
 }
 private void ShowBuildMenu(Tower.Tower tower, Collider other)
 {
     // TODO: Show Build menu
     if (CanPlaceTower(tower.GetPrice()))
     {
         BuyTower(tower, other);
     }
 }
Example #4
0
 private void TowerLevelUp(Tower.Tower tower)
 {
     if (tower.LevelUp())
     {
         Debug.Log("Level up successful");
     }
     else
     {
         Debug.Log("Not enough gold");
     }
     UpdateTowerInfo(tower);
 }
        public override void Initialize()
        {
            _applets = new List<Applet.Applet>();
            _applets.Add(Player.GetInstance());
            _applets.Add(Battle.GetInstance());
            _applets.Add(Dialogue.GetInstance());
            _applets.Add(Applet.Shop.GetInstance());
            _applets.Add(MonsterBook.GetInstance());
            _tower = Tower.Tower.GetInstance();
            _audioPlayer = AudioPlayer.GetInstance();

            for (int i = 0; i < _applets.Count; i++)
                _applets[i].Initialize();
            _tower.Initialize();

            _audioPlayer.Play(AudioPlayer.BackgroundMusic.Exploration);
        }
Example #6
0
        private void Update()
        {
            if (Input.GetMouseButtonDown(0))
            {
                if (!EventSystem.current.IsPointerOverGameObject())
                {
                    RaycastHit hit;
                    Ray        ray = GetComponent <Camera>().ScreenPointToRay(Input.mousePosition);
                    if (Physics.Raycast(ray, out hit, 10000f))
                    {
                        Tower.Tower selectedTower;
                        if ((selectedTower = hit.collider.GetComponent <Tower.Tower>()) != null)
                        {
                            uiController.VisibilityLevelUpPanel(true);
                            uiController.ChangeTowerInfo(selectedTower);

                            if (lastSelectedTower != null)
                            {
                                lastSelectedTower.SelectorActive(false);
                            }
                            lastSelectedTower = selectedTower;

                            selectedTower.SelectorActive(true);
                        }
                        else
                        {
                            if (lastSelectedTower != null)
                            {
                                lastSelectedTower.SelectorActive(false);
                                lastSelectedTower = null;
                            }
                            uiController.VisibilityLevelUpPanel(false);
                        }
                    }
                }
            }
        }
Example #7
0
 public void TowerInfo(Tower.Tower tower)
 {
     levelUpBtn.onClick.RemoveAllListeners();
     levelUpBtn.onClick.AddListener(() => TowerLevelUp(tower));
     UpdateTowerInfo(tower);
 }
 public void ChangeTowerInfo(Tower.Tower tower)
 {
     levelUpPanel.GetComponent <LevelUp>().TowerInfo(tower);
 }
Example #9
0
 public override void Initialize()
 {
     _finalFace = Face.Down;
     _hp = 1000;
     _atk = 100;
     _atkTime = 1;
     _def = 100;
     _gold = 0;
     _exp = 0;
     _keys = new int[] { 55, 55, 0 };
     _currentFloor = 3;
     _battleFrame = 0;
     _currentFrame = 0;
     _active = true;
     _position = new Point(6, 11);
     _tower = Tower.Tower.GetInstance();
     _dialogue = Dialogue.GetInstance();
     _audioPlayer = AudioPlayer.GetInstance();
 }
 public override void Initialize()
 {
     _tower = Tower.Tower.GetInstance();
     _player = Player.GetInstance();
 }