public PursueStrategy(BotController controller, Vector3 destination) : base(controller) { Path path = BotController.Character.World.FindPath(BotController.Character.Position, destination); if (path != null && path.NodeCount > 0) Target = path.PathNodes[0]; }
public override void Update(UpdateEvent evt) { bool approached = BotController.WalkTo(evt, Target.Position); if (!approached) return; Target = Target.Next; }
public Path(Vector3[] positions, bool cycle = false) { PathNodes = new PathNode[positions.Length]; PathNodes[0] = new PathNode(positions[0]); for (int i = 1; i < positions.Length; ++i) { PathNodes[i] = new PathNode(positions[i]); PathNodes[i - 1].Next = PathNodes[i]; } if (cycle) PathNodes[positions.Length - 1].Next = PathNodes[0]; }
public PathNode(Vector3 position, PathNode next = null) { this.Position = position; this.Next = next; }