Refactoring suggestion

This is purely a matter of programming style, but I would also refactor the ‘State’ nodes to get rid of any input handling. The Player node is already doing some input handling and has access to the state manager. It makes sense to me to have some basic state transition logic there as well. Right now we can get rid of all the _Input parts of the PlayerState nodes and add

        if (Input.IsActionJustPressed(GameConstants.INPUT_DASH))
        {
            StateMachine.ChangeState<DashState>();
        }

to the _Input function in Player.cs. This should make adding further states simpler and allow us to see all the input-related state transitions in one place.

My $0.02, thanks.

1 Like

Privacy & Terms