Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: mitchelq on March 24, 2018, 04:37:15 PM
-
Hello,
I would like my c# script to start an event on my PlaymakerFSM. The PlaymakerFSM then does a few things and arrives at it's final state. I then want the script to continue.
What I have so far (1 line of code... :o) just starts the event, but continues my script before the FSM is finished. How can I make it wait?
using UnityEngine;
using HutongGames.PlayMaker;
public class PlayerTurnController : MonoBehaviour {
public PlayMakerFSM fsm;
public void StartPlayerTurn()
{
fsm.Fsm.Event("StartTurn");
// Wait for FSM to do it's thing and then continue
// do other stuff after the FSM is done
}
}
Thanks,
Mitchel
-
Hi,
you have several ways to do this:
- you watch the fsm current state and decide base on the name of the state if youc an carry on.
- you make a custom action on your fsm that will callback your component telling it it's done
- you use action such as sendMessage, or CallMethod, or InvokeMethod to callback your component
Bye,
Jean