While playing along with the tutorial, I thought I’d see if I couldn’t use a switch statement. Somebody out there may be interested in what I did, so here is the code containing the enum switch statement.
private enum States {cell, straw, door_0, door, bucket};
private States gameState;
void Start () {
gameState = States.cell;
}
// Update is called once per frameS
void Update (){
switch (gameState) {
case States.straw:
state_straw ();
break;
case States.bucket:
state_bucket();
break;
case States.door:
state_door();
break;
case States.door_0:
state_door_0();
break;
default:
state_cell();
break;
}