Adding new states to the code
Our future game character should be able to perform typical actions for a character in a game: wait idle for player input, walk in all four main directions, run forward, plus a bunch of other actions. Depending on the available animations, we could add a state for jumping or rolling, punching, or waving.
For maximum flexibility, we will allow characters of all models to perform all the configured actions. Then we can use the UI to map an animation clip to each action we want to use for a specific model. Without a mapped animation clip, the requested action will be simply ignored.
Using bit fields and plain enums
We will add two different enum class definitions to the Enums.h file. The first enum called moveDirection is a bit field:
enum class moveDirection : uint8_t {
none = 0x00,
forward = 0x01,
back = 0x02,
right = 0x04,
left = 0x08,
any = 0xff
};
For every direction, a different bit can be set in a variable. A bit field...