Hi Playmaker community,
Let's say I have a component for a fighting-tower with a custom AI. The tower has a mesh that can "look at" a target position and has a component that handles the internal behaviors like "seek and destroy", "offline", "follow target peacefully", "turn around as fast as possible and shoot like there is no tomorrow".
Without Playmaker I would design a FSM with code. So When the Update() of the tower is called, I would call the FSM.Update() method, which would use polymorphism to call the correct Update() method of the current state.
Now how would I use Playmaker to represent such a FSM with the visual Playmaker window?
Possibility 1: Use the internal FSM for the tower as usual and just use the events from playmaker to handle the state-changes. The communication could happen by calling a method with the "Send Message" action. But this way I still have to use my own FSM implementation.
Possibility 2: Use the FSM from Playmaker and all the events and so forth. Then in the Update() of the tower, I have a lot of if/elseif/switches that check for different parameters and adapt the behavior. Like an enum with SeekAndDestroy, Offline,... This way I can set the parameters directly via actions from Playmaker (like Set Float Value,...) but the internal design is ugly.
Possibility 3: Use custom actions for each state I can be in. So I would pass the original GameObject (the tower) to the action and this action would encapsulate the behavior? It would be like passing the tower to a generic implementation of state design pattern. In this case I would have a custom action for each state the object can be in?
Possibility 4: ...insert your best solution here! ;-)
I'll try to reformulate my problem: When I have an object that behaves differently in different states and this object has to handle code (more complex than the predefined Playmaker actions) in an Update() routine, how do I design an appropriate FSM with playmaker?