public List <clsPathNode> getPossiblePathNodes() { clsSquare square = world.squares[(int)squareLocation.X, (int)squareLocation.Y]; List <clsPathNode> pathNodes = new List <clsPathNode>(); foreach (Vector2 direction in square.directions) { Vector2 newSquareLocation = this.squareLocation + (direction * 64); float weight = Vector2.Distance(squareLocation, newSquareLocation); clsPathNode pathNode = new clsPathNode(newSquareLocation, world, startSquareLocation, endSquareLocation); pathNodes.Add(pathNode); } return(pathNodes); }
clsPathFinding(clsWorld world, Vector2 startSquareLocation, Vector2 endSquareLocation) { // get start then connections and process like video clsPathNode startNode = new clsPathNode(startSquareLocation, world, startSquareLocation, endSquareLocation); startNode.status = PathNodeStatus.procesed; // get connected nodes List <clsPathNode> connectedNodes = startNode.getPossiblePathNodes(); foreach (clsPathNode pathNode in connectedNodes) { pathNode.status = PathNodeStatus.procesed; } }