private void convertMapNodes(DrawableGameComponent [,] mapNodes, Node[,] tempMap) { //mapNodes = new DrawableGameComponent[this.internalMap.MapNodeHeight, this.internalMap.MapNodeWidth]; //Node[,] tempMap = this.internalMap.InternalMapStruct; Vector3 startPosition = new Vector3(-(this.internalMap.MapPixelWidth / 2) + (InternalMap.GridSize / 2), (this.internalMap.MapPixelHeight / 2 - InternalMap.GridSize / 2), InternalMap.GridSize / 2); //Console.WriteLine(startPosition); Node tempNode = tempMap[0, 0]; for (int row = 0; row < this.internalMap.MapNodeHeight; row++) { float x = startPosition.X; for (int col = 0; col < this.internalMap.MapNodeWidth; col++) { tempNode = tempMap[row, col]; if (tempNode is RoomNode) { Room room = new Room(this.game, (RoomNode)tempNode, new Vector3(startPosition.X, startPosition.Y, startPosition.Z)); mapNodes[row, col] = room; } else if (tempNode is WallNode) { Wall wall = new Wall(this.game, (WallNode)tempNode, new Vector3(startPosition.X, startPosition.Y, startPosition.Z)); mapNodes[row, col] = wall; } if (tempNode is EmptyNode) { EmptySpace empty = new EmptySpace(this.game); mapNodes[row, col] = empty; } startPosition.X = startPosition.X + tempNode.Width * InternalMap.GridSize; } startPosition.X = x; startPosition.Y = startPosition.Y - tempNode.Width * InternalMap.GridSize; } }
private void convertMapNodes(DrawableGameComponent [,] mapNodes, Node[,] tempMap) { //mapNodes = new DrawableGameComponent[this.internalMap.MapNodeHeight, this.internalMap.MapNodeWidth]; //Node[,] tempMap = this.internalMap.InternalMapStruct; Vector3 startPosition = new Vector3(-(this.internalMap.MapPixelWidth / 2) + (InternalMap.GridSize / 2), (this.internalMap.MapPixelHeight / 2 - InternalMap.GridSize / 2), InternalMap.GridSize / 2); //Console.WriteLine(startPosition); Node tempNode = tempMap[0, 0]; for (int row = 0; row < this.internalMap.MapNodeHeight; row++) { float x = startPosition.X; for (int col = 0; col < this.internalMap.MapNodeWidth; col++) { tempNode = tempMap[row, col]; if (tempNode is RoomNode) { Room room = new Room(this.game, (RoomNode)tempNode, new Vector3(startPosition.X, startPosition.Y, startPosition.Z)); mapNodes[row, col] = room; } else if (tempNode is WallNode) { Wall wall = new Wall(this.game, (WallNode)tempNode, new Vector3(startPosition.X, startPosition.Y, startPosition.Z)); mapNodes[row, col] = wall; } if (tempNode is EmptyNode) { EmptySpace empty = new EmptySpace(this.game); mapNodes[row, col] = empty; } startPosition.X = startPosition.X + tempNode.Width * InternalMap.GridSize; } startPosition.X = x; startPosition.Y = startPosition.Y - tempNode.Width * InternalMap.GridSize; } }