示例#1
0
 public static Action <Entity> MoveToTargetIfInRange(Entity entity, Entity target, float aggroRange, byte priority = 0)
 {
     if (target != null)
     {
         float distance = Behaviours.GetVectorToTargetEntity(entity, target).magnitude;
         if (distance < aggroRange)
         {
             return(Behaviours.GetMoveToTargetEntityCommand(entity, target, priority));
         }
     }
     return(null);
 }
示例#2
0
 public static Action <Entity> MoveToTargetIfInRangeAndSight(Entity entity, Entity target, float aggroRange, byte priority = 0)
 {
     if (target != null)
     {
         Vector2?vec = Behaviours.GetVectorToTargetEntityIfInSight(entity, target);
         if (!vec.HasValue)
         {
             return(null);
         }
         float distance = vec.Value.magnitude;
         if (distance < aggroRange)
         {
             return(Behaviours.GetMoveToTargetEntityCommand(entity, target, priority));
         }
     }
     return(null);
 }