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. } }
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(); } }