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); }
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(); }
private void Start() { _towerData = TowersController.GetTowerData(_towerType); _infoLabel.text = string.Format(InfoString, _towerData.FireSpeed, _towerData.FireDamage, _towerData.FireDistance); }
public static void Build(TowerData towerData) { _instance._onChoose(towerData); }