To fast reducing with deltaTime...

Hi,
iam writing a simple RPG. The player has the ability to sprint a short time to be faster.
In the script i have a variable for stamina, which reduced while sprinting. But if i sprint the Stamina immidiately goes down to zero, no matter how i change the code, reducing the Stamina. I hope someone can help.

The code below is supposed to reduce the float Stamina:

void Update () 
    {		
         Move ();
    }
    	
    private void Move() {
    		
         if(move_state == MovementState.Sprinting){
    			Stamina =- 5 * Time.deltaTime;
    			if(Stamina < 0)
    				Stamina = 0;
    		}
    		
    	}

This line is the problem:

Stamina =- 5 * Time.deltaTime;

What you want is:

Stamina -= 5 * Time.deltaTime;

Your current code with “=- 5 * Time.deltaTime” is being parsed as “= -5 * Time.deltaTime” and jumping straight down into negative numbers!