Example #1
0
        private TaskState Find(Dwarf d, float dt)
        {
            if (State == TaskState.NotActive)
            {

                    AsyncPathfinding.RequestPathfinding(d, new Point((int)d.Position.X, (int)d.Position.Y), new Point((int)d.GetActionVector().X, (int)d.GetActionVector().Y), null);
                    _numerOfPaths = 1;
            }

            _paths.AddRange(AsyncPathfinding.GetFinishedPathsWithData(d));

            if (_paths.Count > _numerOfPaths)
            {

            }

            if (_numerOfPaths != _paths.Count)
                return TaskState.Running;

            PathfindingResult shortestPath = Path.ShortestPath(_paths);

            d.SetMovePath(shortestPath.Path);

            return TaskState.Success;
        }