Пример #1
0
        public Unit Execute(Unit unit, object parameters)
        {
            // find closest non-visible cell
            Dictionary <Point2, Point2> cameFrom = BreadthFirstSearch.CalculateCameFrom(unit.Location, Globals.Instance.GameWorld);
            Point2 closest = FindClosestNonVisibleCell(cameFrom);

            if (closest != Point2.Null)
            {
                Point2[] path = BreadthFirstSearch.GetPath(unit.Location, closest, cameFrom);

                // move towards there
                if (path.Length > 0)
                {
                    //return path[0];
                }
            }

            return(unit);
        }