private void Update() { switch (currentState) { case States.Starting: StartingEvent.Invoke(); break; case States.Playing: PlayingEvent.Invoke(); break; case States.Ending: EndingEvent.Invoke(); break; case States.Dying: DyingEvent.Invoke(); break; default: throw new ArgumentOutOfRangeException(); //back in unity, now we have the events. If you change the current event, it'll play whichever one you select. } }
//Toward end of Stream on 4/1/2019: Introduces hard-coded dynamic alternatives if doesn't work? public void OnSwitch() { switch (CurrentStates) { case States.Starting: StartingEvent.Invoke(); break; case States.Playing: PlayingEvent.Invoke(); break; case States.Ending: EndingEvent.Invoke(); break; default: //Work break; } }
void Update() { switch (CurrentState) { case States.Starting: StartingEvent.Invoke(); break; case States.Playing: PlayingEvent.Invoke(); break; case States.Dying: DyingEvent.Invoke(); break; case States.Ending: EndingEvent.Invoke(); break; default: throw new ArgumentOutOfRangeException(); } }