I’m working on an advanced first person movement, where player can execute many actions defined by an enumeration. Those enumerations determines what the player is exactly doing in that moment, like walking, running or just idle, and that is then used for movement logic.
Each movement should be executed one at a time, and should be always accessible without the need to pass by another first. I made the following system, consisting of a macro, pin-connected to the input axis:
The system is just a bunch of branches checked every time to see if their condition is true, else the next one is checked till the very end. For example, this part here checks if player is walking by comparing the current speed with the MaxWalkSpeed variable, and then checking that the player is not executing any other movement:
The system works just fine, but I perceive it as a poorly made one, since it could be made in a better a cleaner way. I would like to get rid of all the branches, as well as the boolean conditionals, and determine in a more dynamic system which (enum) movement status is the player currently executing. I tried using MultiGate and ForEachLoop for this, but to no avail, as I don’t know how to use them in a correct way.
I’m not asking for an instant resolve, as it would be too much to ask for, but just for some tips or advice if possible. I’m still a very inexperienced programmer and I enjoy complex challenges like this, and sometimes I manage to resolve it on my own, but other times I just need the knowledge of more experienced people.