Hello guys, sorry for bothering but I have a little problem. I have added in my CharacterMotor script a running script that looks like this :
var running : boolean = false;
var cannotRun : boolean = false;
var timer : float = 0;
if(Input.GetButtonDown ("Run"))
{
running = true;
}
else if(!Input.GetButton("Run"))
{
running = false;
}
if(running == true){
maxForwardSpeed = 5;
maxSidewaysSpeed = 5;
maxBackwardsSpeed = 5;
timer += Time.smoothDeltaTime;
}
if( timer >= 20){
timer = 20;
running = false;
cannotRun = true;
}
if( timer <= 10){
cannotRun = false;
}
if ( cannotRun == true){
running = false;
}
if(running == false){
maxForwardSpeed = 3;
maxSidewaysSpeed = 3;
maxBackwardsSpeed = 3;
timer -= Time.smoothDeltaTime;
}
if( timer <= 0){
timer = 0;
}
It is attached to Function Update()
My maxForwardSpeed is not changing and I don’t know why.
Thanks for future help.
CharacterMotor : Unity3d - Motion - Pastebin.com