public static void AddMana(this ICharacterClass characterClass, float manaPointsToAdd)
        {
            float currentMana = characterClass.GetCurrentMana();
            float maximumMana = characterClass.GetMaximumMana();

            bool manaOverflow = currentMana + manaPointsToAdd > maximumMana;

            float validatedMana = manaOverflow ? maximumMana
                                               : currentMana + manaPointsToAdd;

            characterClass.SetCurrentMana(validatedMana);
            characterClass.GetStatusBarManager().PerformValueChangeTextEffectWithColor(manaPointsToAdd, StateValueChangeAction.ChangeMana);
        }
 public void ManaButton_OnClick()
 {
     selectedCharacterClass.AddMana(selectedCharacterClass.GetMaximumMana());
 }
示例#3
0
 private void RefreshPlayerStatusBar()
 {
     staminaBarFillImage.fillAmount = characterClass.GetCurrentStamina() / characterClass.GetMaximumStamina();
     manaBarFillImage.fillAmount    = characterClass.GetCurrentMana() / characterClass.GetMaximumMana();
     healthBarFillImage.fillAmount  = characterClass.GetCurrentHealth() / characterClass.GetMaximumHealth();
 }