Hi all, the for loop has me lost, and in particular I don’t understand this section of code:
for(int index = 0; index < nextStates.Length; index++)
{
if (Input.GetKeyDown(KeyCode.Alpha1 + index))
{
state = nextStates[index];
}
I am particularly confused about: if (Input.GetKeyDown(KeyCode.Alpha1 + index))
I don’t understand how this code still lets Alpha2 and Alpha3 work - somehow the program still works when you hit Alpha2 or Alpha3, but how can they work when they aren’t even mentioned?
Sorry - this isn’t explained perfectly, but I’m totally lost.