public TowersSettings() { instance = this; attackPosition = new Dictionary <string, Vector2> (); towerPlacePosition = new Dictionary <string, Vector2> (); buffs = new Dictionary <string, List <string> > (); upgrades = new Dictionary <string, List <string> > (); startTowers = new List <string> (); var text = (ResourcesController.LoadOnce("Towers") as TextAsset).text; var towers = text.Split('\n'); foreach (var s in towers) { if (s == "") { continue; } var res = s.Split('|'); var name = res [0]; if (name == "") { continue; } var ups = res [1].Split('☺'); upgrades.Add(name, new List <string> ()); for (int i = 1; i < ups.Length; i++) { upgrades [name].Add(ups [i]); } var bfs = res [2].Split('☺'); buffs.Add(name, new List <string> ()); for (int i = 1; i < bfs.Length; i++) { buffs [name].Add(bfs [i]); } if (res [3] == "True") { startTowers.Add(name); } attackPosition.Add(name, new Vector2(float.Parse(res [4].Split('☺') [0]), float.Parse(res [4].Split('☺') [1]))); towerPlacePosition.Add(name, new Vector2(float.Parse(res [5].Split('☺') [0]), float.Parse(res [5].Split('☺') [1]))); } }
public override void Damage(float damage, string attackerType) { if (isKilling) { return; } float lastDefence = defence; if (TowersSettings.Buffs(attackerType).Contains(Tower.Buff.MagicSkills.ToString()) && Settings.IsLearned("Chaotic")) { defence = 0; } if (TowersSettings.Buffs(attackerType).Contains(Tower.Buff.MagicSkills.ToString()) && Settings.IsLearned("Fatal")) { damage = 100000017; } health -= damage; if (TowersSettings.Buffs(attackerType).Contains(Tower.Buff.LazerSkills.ToString()) && Settings.IsLearned("LazerEffect")) { effects [Effect.Visible] = 1f; } if (TowersSettings.Buffs(attackerType).Contains(Tower.Buff.LazerSkills.ToString()) && Settings.IsLearned("UnitSlow")) { effects [Effect.Slow] = 1f; } defence = lastDefence; if (health <= 0) { if (TowersSettings.Buffs(attackerType).Contains(Tower.Buff.MagicSkills.ToString()) && Settings.IsLearned("UnitGold")) { GameController.IncreaseGold(color == TeamColor.Red?TeamColor.Blue:TeamColor.Red, goldReward / 2); } if (TowersSettings.Buffs(attackerType).Contains(Tower.Buff.MagicSkills.ToString()) && Settings.IsLearned("UnitLife")) { GameController.killedUnitsToHeal++; } } }
public Tower(string _type, Colorable.TeamColor _color) { reloadTime = 0.6f; type = _type; color = _color; gameObject = GamePullController.CreateImage(); animation = new ObjectAnimation(gameObject); gameObject.name += "Tower"; gameObject.GetComponent <BoxCollider> ().enabled = true; texture = Resources.Load("Textures/Towers/" + type + "Tower") as Texture; attackAnimaton = type + "TowerAttack"; attackAnimatonTime = 0.2f; try { damage = BalanceSettings.damage [type]; damageDelta = BalanceSettings.deltaDamage [type]; attackRange = BalanceSettings.attackRange [type]; attackSpeed = BalanceSettings.attackSpeed [type]; } catch (Exception) { Debug.LogError("Wrong tower type: " + type); } layer = 6; size = new Vector2(texture.width / 50f, texture.height / 50f) / 2f * Settings.FhdToHD; GameController.towers.Add(this); GameController.towersDictionary.Add(gameObject, this); buffs = new Dictionary <Buff, float> (GameController.buffs[color]); foreach (var buff in TowersSettings.Buffs(type)) { buffs.Add((Buff)Enum.Parse(typeof(Buff), buff), 1); } }