private void ManageState()
{
var nextStates = currentState.GetNextState();
KeyCode[] bets = {KeyCode.A,KeyCode.B,KeyCode.C};
for(int id = 0; id<nextStates.Length; id++)
for(int a = 0; a<bets.Length; a++)
{
{
if (Input.GetKeyDown(bets[a]))
{
currentState = nextStates[id];
}
}
}
I didn’t even realise you could make an array of KeyCodes, but the nested For Loops here works for my text based game, which uses KeyCodes, rather than numbers. Was originally going for the strings of A, B and C, but realised they didn’t take the type of KeyCode, so tried out a KeyCode array and it worked! This might be useful for when I have to play around with multiple inputs.