Stamina + abilities & UI Bar 🏃♂️💨
This feature includes the stamina feature, and includes as a package abilities that automatically add stamina and others to trigger the addition (just like mana has currently).
IMPORTANT: This feature (as well as others that change the stats enum) will remove every stats in you game, this includes: monsters, some abilities, heros, save (bonus stats) etc. I advice following this guide so that you don’t ever have this problem:
Change “Stats.cs”
(1) Add the following param to the “EStat” enum
public enum EStat
{
... //others
Stamina = 8
}
Add (+1) to the “StatCount” variable:
public class Stats
{
public const int StatCount = 9; //changed from 8 to 9
...
}
Change “ActiveAbilitySheet.cs”:
Add the following:
[SerializeField] private int m_staminaCost = 0;
public int staminaCost => m_staminaCost;
Change “ActiveAbilityBase.cs”
Add param to the enum:
public enum EAbilityFireCheckResult
{
//others
NotEnoughStamina //add this
}
Add inside the “Fire” method after the “ConsumeMana();”:
public void Fire(UnityAction onAbilityEnded)
{
//..othercode
ConsumeStamina(); //add this
//..othercode
}
Add the “ConsumeStamina” method after the (ConsumeMana) method
protected virtual void ConsumeStamina()
{
m_character.ConsumeStamina(abilitySheet.staminaCost);
}
Inside method “CanFire()” before the “return” add:
if (m_character.currentStats[EStat.Stamina] < abilitySheet.staminaCost)
{
return EAbilityFireCheckResult.NotEnoughStamina;
}
//return EAbilityFireCheckResult.Valid; (before this return)
(continue in the comments)
Change CharacterBase.cs
Add the following, after the method “ConsumeMana”:
public void RecoverStamina(int value, EEffectVisualFlags visualFlags = EEffectVisualFlags.None)
{
int missingStamina = m_stats[EStat.Stamina] - m_currentStats[EStat.Stamina];
m_currentStats[EStat.Stamina] += math.min(value, missingStamina);
//GameManager.NotificationSystem.manaRecovered.Invoke(this, value, visualFlags); (this is optional)
}
public void ConsumeStamina(int value, EEffectVisualFlags visualFlags = EEffectVisualFlags.None)
{
m_currentStats[EStat.Stamina] -= math.min(value, m_currentStats[EStat.Stamina]);
//GameManager.NotificationSystem.staminaConsumed.Invoke(this, value, visualFlags); (this is optional)
}
(continue in the comments)
UI Bar
For the UI, just open the prefab “User Interface”, inside of “HUD->Resources Bars” duplicate one of the bars and change it’s name to “Stamina Bar”. In the inspector, change the stat to Stamina [image in attachment] Also, change the “Stamina Bar->Slider->Fill Area-> Fill” background image to the green one [image in attachment]
Translations
Change the config file “CFG_Game” in “Demo->Database->Config”, include the following in both placed like you see in the images
Finally install this package!
Let me know if anything goes wrong!

💬 Comments (4)
Hmm may i ask, what is the “left stick” for on the screen 🤔
Either way this is an amazing addon!!
Oh? 👀
I CANT WAIT for that if you’re actually gonna share it!
Want to continue the conversation?