You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
972 B
C#

using UnityEngine;
namespace MalbersAnimations.Controller.AI
{
[CreateAssetMenu(menuName = "Malbers Animations/Pluggable AI/Decision/Arrived to Target",order = -100)]
public class ArriveDecision : MAIDecision
{
public override string DisplayName => "Movement/Has Arrived";
[Space,Tooltip("(OPTIONAL)Use it if you want to know if we have arrived to a specific Target")]
public string TargetName = string.Empty;
public override bool Decide(MAnimalBrain brain, int index)
{
bool Result;
if (string.IsNullOrEmpty(TargetName))
{
Result =
brain.AIControl.HasArrived;
}
else
{
Result =
brain.AIControl.HasArrived &&
brain.Target.root.name == TargetName; //If we are looking for an specific Target
}
return Result;
}
}
}