This is why developers introduced the state machine, it’s pretty straightforward to implement, especially with our C#.
For example, create a StateMachine
class and a State
abstract class with some nice virtual EnterState()
, LogicProcess()
, PhysicsProcess()
, and ExitState()
methods. Then create TransitionTo()
in the state machine. This is pretty much what it is.