playMaker

Author Topic: Check FSM Status  (Read 2876 times)

ciabaros

  • Playmaker Newbie
  • *
  • Posts: 13
Check FSM Status
« on: April 11, 2013, 02:36:07 PM »
Action to check another FSM's running status.
Running: enabled and active
Stopped: disabled or inactive



Attached is the zip, just put it in next release :)

Why it's awesome:
This is an action that checks or waits (depending on "everyFrame" option) if/when an FSM is running or stopped. This allows you to use completely separate FSMs as SubFSMs.
Example 1: Start an animation FSM (by enabling, or sending event), which disables itself once finished (that's the key of this design pattern), and use this action to wait until it's complete, without having to use global variables, or unnecessary cross-FSM awareness.
Example 2: Have a manager-FSM wait until some button (or its FSM) in the scene is enabled (assuming its FSM is disabled by default), and then continue state flow based on that.

Why Using Current Functionality to do this on GameObject Level is NOT the same:
I have a character who's always there, but animates an attack once in a while, that attack animation action can be just another FSM, which is always disabled until it need to do its animation, reset the visual state, and disable itself (FSM self). Working on GO level gives much less control, and/or is much more complex to set up.
« Last Edit: April 12, 2013, 11:08:06 PM by ciabaros »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Check FSM Status
« Reply #1 on: April 12, 2013, 02:26:59 AM »
Hi,

 Very well written custom Action!

 Will remember this, I actually never stop fsm from running ( because there is not FINISH event like there is a START, but I understand your use case, I'll try to use this pattern more.
 
bye,

 Jean