public Unit(int heroID, string name, double purchaseCost, string icon) { unitSkills = new List <UnitSkill>(); this.heroID = heroID; this.name = name; this.purchaseCost = purchaseCost; this.level = 0; this.icon = icon; GetUnitSkills(); this.nextSkillToUnlock = GetNextSkill(); UpdateUnitStats(); }
public UnitSkill GetNextSkill() { UnitSkill skill = new UnitSkill(100, BonusType.AllDamage, 0, 0); foreach (var Skill in scene.skillList) { if (Skill.ownerID == this.heroID && !Skill.isUnlocked) { return(Skill); } } return(skill); }
public void UpdateUnitStats() { if (this.level == nextSkillToUnlock.requiredLevel) { nextSkillToUnlock.isUnlocked = true; nextSkillToUnlock = GetNextSkill(); } this.currentDPS = GetDPSByLevel(this.level); this.nextUpgradeCost = GetUpgradeCostByLevel(this.level); if (this.level + 1 == nextSkillToUnlock.requiredLevel) { double tmpDPS = GetDPSByLevel(this.level); nextSkillToUnlock.isUnlocked = true; this.nextLevelDPSDiff = GetDPSByLevel(this.level + 1) - tmpDPS; nextSkillToUnlock.isUnlocked = false; } else { this.nextLevelDPSDiff = GetDPSByLevel(this.level + 1) - GetDPSByLevel(this.level); } }