#if HAVE_NODECANVAS using System; using UnityEngine; using ParadoxNotion.Design; using NodeCanvas.Framework; using NodeCanvas.StateMachines; namespace Framework.State { /// Terminates the calling FSM and starts another FSM [Category("Utility")] [Description("Terminates the calling FSM and starts another FSM")] public class ContinueWithFsmTask : ActionTask { /// State machine that will be started [RequiredField] public BBParameter ContinueFsm; /// Summary of what this action does protected override string info { get { return "Continue with " + this.ContinueFsm.ToString(); } } /// Called once when the action is executed protected override void OnExecute() { FSMOwner runningFsmOwner = base.agent.GetComponent(); if(runningFsmOwner == null) { string agentName; if(base.agent == null) { agentName = "(none)"; } else { agentName = base.agent.name; } Debug.LogError( "Tried to disable running FSM, but execution agent '" + agentName + "' " + "does not contain the FSMOwner component. Unbound FSM graph used?" ); return; } runningFsmOwner.enabled = false; this.ContinueFsm.value.enabled = true; EndAction(); } } } // namespace Framework.State #endif // HAVE_NODECANVAS