public void CheckHealthUnit() { UnitUI uUI = game.GetUnitUI(this); if (_current_hp <= 0.0f) { uUI.GetComponent <Animations>().PlayAnimation(AnimationType.DEAD); } else { if (GetStunStatus() == null) { uUI.GetComponent <Animations>().PlayAnimation(AnimationType.IDLE); } } UpdateHealthBar(); }
void DamageUnit(Ability ability) { UnitUI uUI = game.GetUnitUI(this); if (ability.type == AbilityType.PROTECTION) { } else if (ability.type == AbilityType.STUN) { uUI.GetComponent <Animations>().PlayAnimation(AnimationType.STUN); } else if (ability.type == AbilityType.POISONING) { } else { if (IsUnitStatuses()) { Ability status_protection = GetProtectionStatus(); if (status_protection != null) { if (ability.type == AbilityType.RECOVERY) { current_hp -= ability.damage; } else { current_hp -= ability.damage / 2; } } else { current_hp -= ability.damage; } } else { current_hp -= ability.damage; } } }