コード例 #1
0
        public GeoCoordinate NextStep(GeoCoordinate actualLocation)
        {
            if (!Waypoints.Any())
            {
                return(_lastNextStep ?? (_lastNextStep = actualLocation));
            }

            do
            {
                _lastNextStep = Waypoints.FirstOrDefault();
                Waypoints.Remove(_lastNextStep);
            } while (actualLocation.GetDistanceTo(_lastNextStep) < 20 || Waypoints.Any());

            return(_lastNextStep);
        }
コード例 #2
0
ファイル: MapNpc.cs プロジェクト: Metibor/ualbion
 public void LoadWaypoints(ISerializer s)
 {
     if ((Movement & MovementType.RandomMask) != 0)
     {
         var wp = Waypoints?.FirstOrDefault() ?? new Waypoint();
         wp.X      = s.UInt8("X", wp.X);
         wp.Y      = s.UInt8("Y", wp.Y);
         Waypoints = new[] { wp };
     }
     else
     {
         Waypoints ??= new Waypoint[0x480];
         for (int i = 0; i < Waypoints.Length; i++)
         {
             Waypoints[i].X = s.UInt8(null, Waypoints[i].X);
             Waypoints[i].Y = s.UInt8(null, Waypoints[i].Y);
         }
     }
 }
コード例 #3
0
 public static WaypointData GetWaypointByWorldId(int worldId)
 {
     return(Waypoints.FirstOrDefault(o => o.Value.WorldSnoId == worldId).Value);
 }
コード例 #4
0
 public static WaypointData GetWaypointByLevelAreaId(int levelAreaId)
 {
     return(Waypoints.FirstOrDefault(o => o.Value.LevelAreaSnoId == levelAreaId).Value);
 }
コード例 #5
0
 public Point GetPointById(string id) => Waypoints.FirstOrDefault(p => p.ID == id);