public Stack <Point> findShortestPath() { openList.Clear(); closedList.Clear(); path_calculated = false; Stack <Point> path; currentDirection = clientMap.Client.getcDirection(); switch (mode) { //revalue the node types in the context of each mode case Game_AI.Mode.Offensive: NodeType.tank = 1; NodeType.coinPile = 2; NodeType.brick = 3; NodeType.lifePack = 4; break; case Game_AI.Mode.Greedy: NodeType.coinPile = 1; NodeType.lifePack = 2; NodeType.brick = 3; NodeType.tank = 4; break; case Game_AI.Mode.Defensive: NodeType.lifePack = 1; NodeType.coinPile = 2; NodeType.brick = 3; NodeType.tank = 4; break; } //generates the client map for path finding generateMap(); startX = clientMap.Client.getxCordinate(); clientMap.Client.getyCordinate(); openList.Add(map[startX, startY]); while (!path_calculated) { analyzeNeighbours(); } this.path = findPath(); return(this.path); }
public void setCDirection(DirectionConstant d) { this.cDirection = d; }