public static void DashToUnit(IObjAiBase unit, ITarget target, float dashSpeed, bool keepFacingLastDirection, string animation = null, float leapHeight = 0.0f, float followTargetMaxDistance = 0.0f, float backDistance = 0.0f, float travelTime = 0.0f ) { if (animation != null) { var animList = new List <string> { "RUN", animation }; _game.PacketNotifier.NotifySetAnimation(unit, animList); // TODO: Move PacketNotifier usage to less abstract classes (in this case ObjAiBase) } if (target.IsSimpleTarget) { var newCoords = _game.Map.NavigationGrid.GetClosestTerrainExit(new Vector2(target.X, target.Y)); var newTarget = new Target(newCoords); unit.DashToTarget(newTarget, dashSpeed, followTargetMaxDistance, backDistance, travelTime); _game.PacketNotifier.NotifyDash( unit, newTarget, dashSpeed, keepFacingLastDirection, leapHeight, followTargetMaxDistance, backDistance, travelTime ); } // TODO: Move PacketNotifier usage to less abstract classes (in this case ObjAiBase) else { unit.DashToTarget(target, dashSpeed, followTargetMaxDistance, backDistance, travelTime); _game.PacketNotifier.NotifyDash( unit, target, dashSpeed, keepFacingLastDirection, leapHeight, followTargetMaxDistance, backDistance, travelTime ); // TODO: Move PacketNotifier usage to less abstract classes (in this case ObjAiBase) } unit.TargetUnit = null; }