public override Tower CreateTower(TowerType type, Position position) { switch (type) { case TowerType.SOLDIER: return(new TowerBuilder(position) .SetName(type.ToString().ToLower()) .SetRate(2) .SetDamage(10) .SetRange(80) .SetPrice(50) .GetResult()); case TowerType.ARCHER: return(new TowerBuilder(position) .SetName(type.ToString().ToLower()) .SetRate(10) .SetDamage(3) .SetRange(50) .SetPrice(30) .GetResult()); default: return(null); } }
private IEnumerator LoadAllTowerObj(List <TowerType> choosedTowerList) { LoadComplete = false; ResourceRequest rr; for (int i = 0; i < choosedTowerList.Count; i++) { TowerType towerType = choosedTowerList[i]; Tower tower = Resources.Load <Tower>($"ScriptableObject/Tower/{towerType.ToString()}Tower"); _towerDic.Add(towerType, tower); tower.maxLevel = SetTowerLevel(tower.towerMsg, 0); rr = Resources.LoadAsync <GameObject>($"Tower/{towerType.ToString()}Tower"); yield return(rr); _curLoad++; _towerBaseObjDic.Add(towerType, rr.asset as GameObject); for (int j = 0; j != (int)UiType.End; j++) { UiType uitype = (UiType)j; string uiType = uitype.ToString(); rr = Resources.LoadAsync <GameObject>($"UI/{uiType}/{towerType.ToString()}{uiType}"); yield return(rr); switch (uitype) { case UiType.ChooseBtn: _chooseUiDic.Add(towerType, rr.asset as GameObject); break; case UiType.UpGradeBtn: // upgradeUiDic.Add(towerType,rr.asset as GameObject); break; } _curLoad++; } } //LoadBuildRes for (int i = 0; i != (int)ResType.End; i++) { ResType resType = (ResType)i; string resTypeStr = resType.ToString(); rr = Resources.LoadAsync <BuildRes>($"ScriptableObject/BuildResources/{resTypeStr}"); yield return(rr); if (!_buildResDic.ContainsKey(resType) && rr.asset != null) { _buildResDic.Add(resType, rr.asset as BuildRes); } } LoadComplete = true; }
/// <summary> /// Overwites Tostring for TowerPlacers /// </summary> /// <returns></returns> public override string ToString() { if (towerAmount > 1000) { return(towerType.ToString() + " ($" + towerBuildCost + ")"); } else { return(towerType.ToString() + ": " + towerAmount.ToString() + " ($" + towerBuildCost + ")"); } }
public BaseTower GetTowerOfType(TowerType towerType) { BaseTower newTower = null; switch (towerType) { case TowerType.BaseDrum: { newTower = GameObject.Instantiate(TowerPrefabMapper.KickDrumPrefab); break; } case TowerType.HighHat: { newTower = GameObject.Instantiate(TowerPrefabMapper.HighHatPrefab); break; } } IncrementGlobalTowerCount(towerType); var towerName = towerType.ToString() + GlobalTowerTypeCount[towerType]; newTower.Data.TowerType = towerType; newTower.Data.ID = towerName; newTower.gameObject.name = towerName; return(newTower); }
private void AttachButtonEvent(Content.TowerSelectionPanel buttonName, TowerType type) { var button = (InteractiveButton)GetSceneControl(buttonName.ToString()); button.AddTag(type.ToString()); button.Clicked += () => BuildTower(type); towerButtonPanel.Add(button); }
private void OnMouseEnter() { if (!m.autoplay.replayRunning()) { tower_panel.updatePanel(sprite.sprite, type.ToString(), stats); } }
public TowerStat GetStatByLevel(TowerType type, int lvlId) { var stat = _allJsons[type].list.FirstOrDefault(i => i.levelId == lvlId); if (stat == null) { throw new Exception("GetStatByLevel > JSON Object does not exist. There isn't a tower type : " + type.ToString() + " with a levelID : " + lvlId); } return(stat); }
public void UpdateShopUI(Shop shop) { foreach (GameObject go in towerButtons) { ShopItem shopItemInfo = go.GetComponent <ShopItem>(); TowerType currentTowerType = shop.currentShop[shopItemInfo.index]; if (currentTowerType != TowerType.None) { shopItemInfo.costText.text = GameStats.Instance.GetCost(currentTowerType).ToString(); shopItemInfo.nameText.text = currentTowerType.ToString(); shopItemInfo.towerImage.sprite = GameStats.Instance.GetShopPortrait(currentTowerType); } } }
public static ParticleSystem GetHitEffect(TowerType attackType) { if (HitEffects[(int)attackType] != null) return HitEffects[(int)attackType]; try { var effectData = ContentLoader.Load<ParticleSystemData>(attackType.ToString() + EffectType.Hit); return HitEffects[(int)attackType] = new ParticleSystem(effectData); } catch //ncrunch: no coverage start { return HitEffects[(int)attackType] = FallbackEffects.AttackEffect(); } //ncrunch: no coverage end }
public void AddTower(TowerType towerType, Vector3 position) { GameObject prefab; if (towerType == TowerType.CLOCKWISE) { prefab = ClockwiseTowerPrefab; } else if (towerType == TowerType.COUNTER_CLOCKWISE) { prefab = CounterClockwiseTowerPrefab; } else { throw new ArgumentException("Unrecognized tower type: " + towerType.ToString(), "towerType"); } GameObject.Instantiate(prefab, position.Flatten(), Quaternion.identity); }
public void BuildTowerAndPlaySoldSound(TowerType type) { towerType = type; fileName = "Tower" + Enum.Parse(typeof(TowerType), towerType.ToString()) + "Sold"; AttachActionToSpaceButton(ShowTowerAndPlaySound); }
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 BuildTowerAndPlayUpgradeSound(TowerType type) { towerType = type; AttachActionToSpaceButton(ShowTowerAndPlaySound); fileName = "Tower" + Enum.Parse(typeof(TowerType), towerType.ToString()) + "Upgrade"; }
public override string ToString() { return("+" + amount + " " + towerType.ToString()); }
/// <summary> /// Get TowerModel from it's TowerType and it's upgrades /// </summary> /// <param name="towerType">Type of tower you want</param> /// <param name="path1">Number of upgrades in first path</param> /// <param name="path2">Number of upgrades in second path</param> /// <param name="path3">Number of upgrades in third path</param> /// <returns></returns> public static TowerModel GetTowerModel(this GameModel model, TowerType towerType, int path1 = 0, int path2 = 0, int path3 = 0) { return(model.GetTower(towerType.ToString(), path1, path2, path3)); }