public static void AddStamina(this ICharacterClass characterClass, float staminaPointsToAdd)
        {
            float currentStamina = characterClass.GetCurrentStamina();
            float maximumStamina = characterClass.GetMaximumStamina();

            bool staminaOverflow = currentStamina + staminaPointsToAdd > maximumStamina;

            float validatedStamina = staminaOverflow ? maximumStamina
                                                     : currentStamina + staminaPointsToAdd;

            characterClass.SetCurrentStamina(validatedStamina);
            characterClass.GetStatusBarManager().PerformValueChangeTextEffectWithColor(staminaPointsToAdd, StateValueChangeAction.ChangeStamina);
        }
 public void StaminaButton_OnClick()
 {
     selectedCharacterClass.AddStamina(selectedCharacterClass.GetMaximumStamina());
 }
Exemple #3
0
 private void RefreshPlayerStatusBar()
 {
     staminaBarFillImage.fillAmount = characterClass.GetCurrentStamina() / characterClass.GetMaximumStamina();
     manaBarFillImage.fillAmount    = characterClass.GetCurrentMana() / characterClass.GetMaximumMana();
     healthBarFillImage.fillAmount  = characterClass.GetCurrentHealth() / characterClass.GetMaximumHealth();
 }