PC-20230316NUNE\Administrator 3afb2e3b86 临时提交
2024-08-17 14:12:46 +08:00

30 lines
709 B
C#

using System;
namespace BehaviorTreeSlayer
{
public class EventCaller : ConditionalNode
{
[OutField]
public string Event;
public override void Enter(object args)
{
BehaviorTree tree = (BehaviorTree)args;
if (!string.IsNullOrEmpty(Event))
tree.Regist(Event, OnEvent);
}
public override void Exit(object args)
{
}
private void OnEvent(object obj)
{
IsConditionOK = true;
}
public override TaskResult Tick(double dt, object args = null)
{
return IsConditionOK ? TaskResult.Running : TaskResult.None;
}
}
}