Hi. There isn’t a clear place to ask this questions so the scripting forum is my best guess. I am struggling with a good, scalable, sensible pattern for using Playmaker FSMs and scripts to build my game.
I’m currently prototyping. I’ll try to illustrate my example in a simplified and contrived way. Just bear with me.
I have a prefab of a car. The car has an engine. There is a simple Canvas UI that has three buttons.
Button1: should toggle the engine on or off
Button2: shifts the car into forward gear
Button3: shifts the car into reverse gear
Some logics:
The engine should only run if the car is in one gear or another.
The engine, if running, should stop if there is no more fuel
The car can only be in one gear or the other (obvs)
So, what I am struggling with is where to put all this logic. Some things feel they should be in script(s). Some concerns feel like they should be in the FSM. I am not finding any clear examples of how to break something like this down and create a scalable pattern.
I liked the idea of using the FSM for control flow and the UI and then passing messages to scripts. This quickly gets a little clunky but maybe I haven’t found the right way yet. I’ve had some iterations worse than others.
I like the idea of passing events between FSMs but they can’t all be global. This car prefab will be in my seen in multiple instances. I can’t have a button click putting them all into forward gear!
I may, of course, be missing something.
Again, my ask is: what is a good way to approach what goes in FSMs internally and what can go in scripts and, in the case of the latter, how to integrate the two.
I think I’ve watched every Playmaker video on the youtubes and, I’ve gotten closer but it still feels messy.