IndieGame/client/Assets/ParadoxNotion/NodeCanvas/Tasks/Actions/Utility/SwitchBehaviour.cs

44 lines
1.1 KiB
C#
Raw Normal View History

2024-10-11 10:12:15 +08:00
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using NodeCanvas.BehaviourTrees;
using NodeCanvas.StateMachines;
namespace NodeCanvas.Tasks.Actions
{
[Category("✫ Utility")]
[Description("Switch the entire Behaviour Tree of BehaviourTreeOwner")]
public class SwitchBehaviourTree : ActionTask<BehaviourTreeOwner>
{
[RequiredField]
public BBParameter<BehaviourTree> behaviourTree;
protected override string info {
get { return string.Format("Switch Behaviour {0}", behaviourTree); }
}
protected override void OnExecute() {
agent.SwitchBehaviour(behaviourTree.value);
EndAction();
}
}
[Category("✫ Utility")]
[Description("Switch the entire FSM of FSMTreeOwner")]
public class SwitchFSM : ActionTask<FSMOwner>
{
[RequiredField]
public BBParameter<FSM> fsm;
protected override string info {
get { return string.Format("Switch FSM {0}", fsm); }
}
protected override void OnExecute() {
agent.SwitchBehaviour(fsm.value);
EndAction();
}
}
}