コード例 #1
0
 public void AddPoints(string pathName, int interval, GatherWindow Gwindow)
 {
     if (Path.All(p => p.Name != pathName))
     {
         Path.Add(new Paths(pathName));
         Path.Last().AddPoints(interval, Gwindow);
     }
     else
     {
         Path.First(p => p.Name == pathName).AddPoints(interval, Gwindow);
     }
 }
コード例 #2
0
        unsafe public void AddPoints(int interval, GatherWindow Gwindow)
        {
            var lastHeading = 0f;

            // Save our current heading.
            if (Navigation.TurnFilter)
            {
                lastHeading = Game.PCMobEntity[0].PCMob->Heading;
            }

            // Loop while record flag is true.
            while (Navigation.RecordFlag)
            {
                // Get current position.
                var currentPos = Game.Get2DPos();

                // Get last saved position, or null if there are none.
                var lastPos = Point.LastOrDefault();

                // Check if this is a new entry, or if we have moved from our last position.
                if (lastPos == null || lastPos.x != currentPos.x || lastPos.y != currentPos.y)
                {
                    if (Navigation.TurnFilter && (lastHeading == Game.PCMobEntity[0].PCMob->Heading))
                    {
                        Thread.Sleep(interval);
                        continue;
                    }
                    // Add the saved waypoint information to the log.
                    if (Gwindow != null)
                    {
                        Gwindow.AddTextRec(Point.Count, Game.CurrentZone, Name, currentPos.x, currentPos.y);
                    }

                    // Add the new waypoint.
                    Point.Add(new D3DXVECTOR2(currentPos.x, currentPos.y));

                    // Save out last heading
                    if (Navigation.TurnFilter)
                    {
                        lastHeading = Game.PCMobEntity[0].PCMob->Heading;
                    }
                }
                // End if this is a single add.
                if (interval == 0)
                {
                    return;
                }
                // Hold for the given interval.
                Thread.Sleep(interval);
            }
        }