예제 #1
0
        public TowerData GetTowerData(TowerType towerType)
        {
            TowerData towerData = _towersDictionary.FirstOrDefault(a => a.Type == towerType);

            if (towerData == null)
            {
                towerData = _towersDictionary[0];
                Debug.LogException(new System.Exception("В справочнике нет элемента с типом " + towerType.ToString() + ", установлено значение _towersDictionary[0]"));
            }
            return(towerData);
        }
예제 #2
0
        public void BuildTower(TowerData towerData)
        {
            collider.enabled = false;

            _tower                        = TowersController.GetTowerToBuild(towerData.Type);
            _towerTransform               = _tower.transform;
            _towerTransform.parent        = _buildSpot;
            _towerTransform.localPosition = Vector3.zero;
            _towerTransform.localScale    = Vector3.one;
            _tower.Init(towerData.FireSpeed, towerData.FireDamage, towerData.FireDistance);
            GamePanel.Hide();
        }
예제 #3
0
        private void Start()
        {
            _towerData = TowersController.GetTowerData(_towerType);

            _infoLabel.text = string.Format(InfoString, _towerData.FireSpeed, _towerData.FireDamage, _towerData.FireDistance);
        }
예제 #4
0
 public static void Build(TowerData towerData)
 {
     _instance._onChoose(towerData);
 }