////////////////////////////////////////////// public static void AttachMapPieceToMapNode <T>(T node, List <Vector3> nodes, int _worldNodeSize, int _mapType = -1, int _mapPiece = -1, int _rotation = -1) where T : BaseNode { MapFloorData.Clear(); // storing data for serialzatino MapVentData.Clear(); worldNodeSize = _worldNodeSize; sizeSquared = (worldNodeSize * worldNodeSize); halfCubesWithPanels.Clear(); neighbours = node.neighbours; layerCount = 2; nodeLayerCounter = 0; for (int j = 0; j < nodes.Count; j++) { //Debug.Log("fucken layerCount 2<<<<<: " + layerCount); BuildMapsByIEnum(node, nodes[j], _mapType, _mapPiece, _rotation); layerCount += 1; } }
////////////////////////////////////////////// public static void BuildMap(MapNode node) { MapFloorData.Clear(); // storing data for serialzatino MapVentData.Clear(); neighbourVects = node.neighbourVects; Vector3Int nodeLoc = node.NodeID; int startGridLocX = -(MapSettings.MapNodeCountDistanceXZ / 2 + 1); // local Positions int startGridLocY = -(MapSettings.MapNodeCountDistanceY / 2 + 1); int startGridLocZ = -(MapSettings.MapNodeCountDistanceXZ / 2 + 1); Vector3Int localGridLoc; List <int[]> layers = LoadDataFromMapTextDoc(node.NodeMapPiece); /* * if (node.entrance) * { * KeyValuePair<int, int> mapAndRot = GetShipEntranceMap((int)mapPiece); * mapPiece = mapAndRot.Key; * rotation = mapAndRot.Value; * } */ int objectsCountX = startGridLocX; int objectsCountY = startGridLocY; int objectsCountZ = startGridLocZ; int cubeCounter = 0; for (int y = 0; y < MapSettings.NodeCountOfMapPiecesY; y++) { objectsCountX = startGridLocX; objectsCountZ = startGridLocZ; // floor = layers; // for an extra layer roof of the vents only appearing if no map piece above vent //if (!node.entrance) //{ // if (y == (layers.Count - 1) && neighbourVects[5] != new Vector3Int(-1, -1, -1)) // { // continue; // if so, skip last layer // } //} for (int z = 0; z < MapSettings.NodeCountOfMapPiecesXZ; z++) { objectsCountX = startGridLocX; for (int x = 0; x < MapSettings.NodeCountOfMapPiecesXZ; x++) { localGridLoc = new Vector3Int(objectsCountX, objectsCountY, objectsCountZ); if (layers != null && layers[cubeCounter] != null) { int[] cubeData = layers[cubeCounter]; CubeLocationScript cubeScript = CubeBuilder.CreateCubeObject(localGridLoc, cubeData, node.gameObject.transform); // Create the cube // TIDY THIS UP // A test to see if cube has panel to try make connecting neighbours easier if (cubeScript && cubeScript.CubeIsPanel) { halfCubesWithPanels.Add(cubeScript); } } cubeCounter++; objectsCountX += 1; } objectsCountZ += 1; } objectsCountY += 1; } }