예제 #1
0
        public List <Node> PushPath(Node start, Node end)
        {
            // Make sure the nodes are in the player island
            if (!_playerIsland.Contains(start) || !_playerIsland.Contains(end))
            {
                return(new List <Node>());
            }

            var nodes = new HashSet <Node>();
            var path  = new List <Node>();

            Island.FindPath(start, end, nodes, path);
            path.Reverse();

            return(path);
        }
예제 #2
0
 public void MoveTo(Node node)
 {
     PullPosition  = node.Position;
     _playerIsland = _islandSet.Get(node);
     UpdateState();
 }
예제 #3
0
 /// <summary>
 /// Joins this island with another.
 /// </summary>
 /// <returns>
 /// The island passed as a parameter, now
 /// containing the union of both node sets.
 /// </returns>
 public Island Join(Island island)
 {
     island.ConnectedNodes.UnionWith(ConnectedNodes);
     island._connectedFields.UnionWith(_connectedFields);
     return(island);
 }