public void ChangeSkill(int skillId, Sprite skill, int cost, Constants.CostTypes costType) { isItem = false; itemBack.sprite = skillBackImg; item.sprite = skill; string costSuffix; Color color; switch (costType) { case Constants.CostTypes.Attack: costSuffix = "HP"; color = hpColor; break; default: costSuffix = "MP"; color = mpColor; break; } this.cost.text = cost.ToString() + "\n" + costSuffix; this.cost.color = color; itemId = skillId; skillCost = cost; this.costType = costType; UpdateDisplay(); }
public bool CheckCost(int value, Constants.CostTypes skillType) { if (skillType == Constants.CostTypes.Attack) { if (CurrentHealth - value < 0) { return(false); } } else { if (CurrentMana - value < 0) { return(false); } } return(true); }
public void ApplyCost(int value, Constants.CostTypes skillType) { if (skillType == Constants.CostTypes.Attack) { CurrentHealth -= value; } else { if (CurrentMana - value > Stats.MaxMana) { CurrentMana = Stats.MaxMana; } else { CurrentMana -= value; } } unitManager.UpdateGlobes(); }