ModernUO/Projects/UOContent/Mobiles/BehaviorTreeAI/ConditionNode.cs
2021-09-01 01:07:24 -04:00

25 lines
606 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Server.Mobiles.BehaviorTreeAI
{
public class ConditionNode : LeafNode
{
private Predicate<BaseCreature> predicate;
public ConditionNode(BehaviorTree tree, Predicate<BaseCreature> fn) : base(tree)
{
predicate = fn;
}
public override Result Execute()
{
if (predicate(Tree.Mobile))
{
return Result.Success;
}
return Result.Failure;
}
}
}