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); }