A quick update people, to give you a graphical example of how I handle State Management within Unity.
I've tried a lot of different ways - I've tried "just getting it done" via ... coding context-specific logic; but for every method, I've found that re-writing and logic debugging and such become unmaintainable.
This method, which is extremely modular, separates most of the game logic out into a single inherited class (Action) and all logical connections are formed graphically - in Unity.
Hmm... I wonder if you can read that.
Just a diagram I threw together really quickly, to give a very fast overview:
An Event is a situation that sets a State to a value. (e.g: Jumping = False)
A State is a variable that can hold information (True/False, a number, a sentence, a word)
A State will check its own value and - if it meets certain criteria, will trigger an Action
An Action is where all of the game logic is stored; It will do things that actually affect the game world (e.g: Character move, character animate).
Edit:
To further give an idea of the lifecycle of States:
An Event is triggered by, say... user Input.
An Event changes a State to a value.
A State, if it is a certain value, will trigger Actions.
Actions, upon completion, trigger Events.
And around we go.
Take a look!
My ideal scenario is to have enough time to integrate this system into a modified Unity Editor window - it would be beautiful.
No comments:
Post a Comment