Quick one,
Currently using Unity Random.Range to set a var with the value of an enum state.
State has 4 possible values, up, down, left,right. I call it like :
currentState = (StateType)Random.Range(0, 3);
This gets set at certain conditions.
My issue is though I don't want the new setting to be the same as the current one.
I have taken a look at the random.range on the API but haven't found anything useful.
Is there an easy way to basically say "randomize but not the same as the current state"
EDIT:
Currently im using a while loop.
while (currentState == LastState)
{
currentState = (StateType)Random.Range(0, 3);
}
Is there anything i can do to remove the while loop?