Exemple #1
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);
 }