Hello,
It's been a while since I wanted to make a quick proof of concept of what I'd like to have built in, Sub Fsms.
Basically, being able to run a fsm process within a state opens wild perspective, better reusability, better maintenance, more flexibility, etc etc.
the thing is, playmaker is already that powerful, that it is actually possible to do that already !
I have attached a package showing one way of doing this, using a custom action "SubFsm". I had this in mind, had to get it done to make sure it was feasible.
basically, the idea is to create an empty gameObject, attached ONE fsm to it and save it as a prefab.
This prefab is then used with the action "subFsm" and is created and managed by this subFsm custom action. It currently can do the following:
-- Bind an Fsm float FROM the Fsm TO the SubFsm.
-- Watch for the GameObject destruction and in that case call an event ( one way to trigger an event when the SubFsm is finished).
Obviously the only limitation is the SubFsm custom action interface. For example, a built in integration of such subFsm system by playmaker would required a more advanced UI, to bind any variable and display a list of variables the way we are used to, via a dropdown. The rest would be only convention really. For example, I expect a SubFsm to declare a "__MASTER__" FsmGameObject, I inject in that the Fsm.Owner so that within a SubFsm, we can control the actual GameObject that runs this fsm ( as opposed the gameObject the subFsm is running from, which is of no use, only to support instantiation of this SubFsm).
I'd like to take this one step further, because even as is, I could create a compound set of variable to give total flexibility with bindings ( choosing any variables, from Fsm to SubFsm, AND back, from SubFsm to Fsm).
So, I think, supporting SubFsm, is totally feasible with actually, minimal impact on playmaker current state and features ( it only needs a more flexible or dedicate ui component for this subFsm variable binding).
I'd really like to hear what you have to say about this, and where you'd see this going, that would help me improve the SubFsm custom action.
Playmaker rocks
Bye,
Jean