Debug.Log (escolher);
if (escolher == 1 )
vel = 120;
estranho.transform.Translate (0,0,vel * Time.deltaTime );
if (escolher == 2 )
vel = 125;
estranho.transform.Translate (0,0,vel * Time.deltaTime );
if (escolher == 3 )
vel = 120;
estranho.transform.Translate (0,0,vel * Time.deltaTime * -1);
if (escolher == 4 )
vel = 120;
estranho.transform.Translate (0,0,vel * Time.deltaTime * -1);
if (escolher == 6)
isdodge = false;
}
The problem is that the ramdom.range in each secods choose another number,and don’t allow to make the action to translate until the end,how can i solve this issue
i’m aprreciated!
hi , thought i would put a couple of thoughts down to try and help
your random.range if your looking to include all the integer numbers 1 to 6, then it should be
Random.Range (1,7);
as the max of this is exclusive and is never reached.
might be worth trying this in a case statement.
if your trying to get this called only once in a given time frame, then might be worth wrapping this up in an IF statement with a bool flag that allows the dodge action to be carried out.