How do I create a mana bar?

Hello. I am currently working on an RPG like game and I would like my character to have a mana bar. I would like it so whenever my character casts a spell the mana bar goes down and when it hits 0 he can no longer cast any spells. I think the script would have a default mana value and subtract a certain number from that value whenever my character casts a spell. I also have to make sure that the player cannot cast spells once it hits 0 and have it displayed on the HUD. What would be the best way to go about doing this? Thanks a million!

If you do a search for “unity3d energy bar” or “unity3d health bar” you’ll find a ton of tutorials on how to do it. Here’s one of the first ones that pulled up for me: http://www.thegamecontriver.com/2014/08/unity-46-create-health-bar-hud.html

Of course you’ll need to add you’re own code to stop spells from being cast once the bar is at 0, but that can be done with a simple if statement, such as:

if (healthbar == 0) {
    //do something here to keep spells from being cast, such as setting a boolean to false
}

In addition to post above: make separate class smt like HeroStatController with private fields mana and health. Add public boolean methods IsManaEmpty and IsHealthEmpty

Awesome
I am using ootii
So the big Question is How do you connect it to your Character so every time you cast a spell you lose Mana
I know how to make a UI and play the Mana bar in the scene but for the Life of me I don’t know how to connect it to
my Character

HELPP !!!
Thanks