I feel like this should be a very easy task, the more I try new things and more research I do, the more confused I get.
The code below is from one script, the other script is essentially what holds my TextMesh(s). The way it’s set up, CurrentMeter goes from 0% to 100%. Once it reaches 100% it jumps directly back to 0%.
What i’m trying to do is: I want to flip the percentages so it starts at 100%, goes down to 0%. When at 0% I want it to gradually climb back up to 100% at the same pace as the Time.deltaTime.
public float meterTime = 0.0F;
public float meterMax = 5.0F;
void CheckMeter()
{
meterTime += Time.deltaTime;
if(meterTime >= meterMax)
{
//Activate something by boolean
meterTime = 0;
}
}
void UpdateMeter()
{
CurrentMeter = (meterTime / meterMax) * 50;
ModifyMeter (CurrentMeter) //<---- linked to a HUD Script
}
This is my very first post on here, so if my format is incorrect or sloppy i’m sorry. Id rather someone point out the issue and let me know so I won’t do it again.