コード例 #1
0
 /// <summary>
 /// Starts seeking the specified coordinates. The AI will travel to the node nearest these coordinates but may not end up on these coordinates exactly.
 /// </summary>
 /// <param name="x">The x coordinate to seek.</param>
 /// <param name="y">The y coordinate to seek.</param>
 public void startSeeking(int x, int y)
 {
     if (!seeking)
     {
         seeking       = true;
         target        = null;
         seekX         = x;
         seekY         = y;
         path          = MapNode.getCachedPathTo(new Vector2(this.x, this.y), new Vector2(x, y));
         startSeekTime = DateTime.Now;
         pathIndex     = 0;
     }
 }
コード例 #2
0
 /// <summary>
 /// Starts seeking the FightObject.
 /// </summary>
 /// <param name="target">The target to seek.</param>
 public void startSeeking(FightObject target)
 {
     if (!seeking)
     {
         seeking       = true;
         startSeekTime = DateTime.Now;
         path          = MapNode.getCachedPathTo(new Vector2(x, y), (target is Furniture) ? ((Furniture)target).getClosestCorner(x, y) : new Vector2(target.x, target.y));
         pathIndex     = 0;
         this.target   = target;
         seekX         = target.x;
         seekY         = target.y;
     }
 }