Hi there,
First, I’ll explain what I’m trying to do.
I am making a magic system where energy (a float value which is shown through a slider) is used to fuel your spells (for instance, fireball costs 10 energy, etc.). After using energy, you can either wait for it to recharge (+5 energy every 15 seconds) or take it from an object, like a diamond, if it has it stored in it.
What I am doing is, when you click on the diamond a panel pops up on the screen with a slider on it representing how much energy is stored in the diamond (I’ll say 50 out of a maximum of 100 energy is stored in the diamond right now). You can slide the slider down (to the left) to take that much energy. In this instance, the slider is at half-way (50/100), and you can slide it to the left to take some of that 50 energy for yourself, which would take that much from the diamond and put it into your energy, or, you can store energy, taking it from YOUR energy and putting it the diamond for later use.
My only problem is, how would I accomplish this? I have no idea where to start determining the value that should be given or taken from the character? Basically, if the value goes down, give the amount it goes down to the character, if the value goes up, take it from the character and give it to the diamond, but I do not know how to do that.
Thanks for your help!
P.S I’m using C#