TileFloor GetFloor(bool isSquare, int stX, int stZ, MapTips mapTips3) { //真上からブロックにぶつかるまで探す int baseY = -1; EnumShapeType baseShape = 0; int basePal = 0; bool isFind = false; for (int y = 0; y < mapTips3.mapSizeY; ++y) { int revY = (mapTips3.mapSizeY - y - 1); Vector3Int pos = new Vector3Int(stX, revY, stZ); EnumShapeType shape = mapTips3.GetShape(pos); int pal = mapTips3.GetEvent(pos); if (shape == 0) { continue; //空チップ } if (isSquare) { if (IsTriFloor(shape)) { continue; } } else { if (!IsTriFloor(shape)) { continue; } } baseY = revY + 1; baseShape = shape; basePal = pal; isFind = true; break; } if (isFind) { TileFloor res = new TileFloor(baseShape, basePal, baseY, stX, stZ); return(res); } else { return(null); } }
TileWall GetWall(bool isSquare, int stX, int stY, MapTips mapTips3) { //手前からブロックにぶつかるまで探す int baseZ = -1; EnumShapeType baseShape = EnumShapeType.Empty; int basePal = 0; bool isFind = false; for (int z = 0; z < mapTips3.mapSizeZ; ++z) { Vector3Int pos = new Vector3Int(stX, stY, z); EnumShapeType shape = mapTips3.GetShape(pos); int pal = mapTips3.GetEvent(pos); if (shape == 0) { continue; //空チップ } if (isSquare) { if (IsTriWall(shape)) { continue; } } else { if (!IsTriWall(shape)) { continue; } } baseZ = z; baseShape = shape; basePal = pal; isFind = true; break; } if (isFind) { TileWall res = new TileWall(baseShape, basePal, baseZ, stX, stY); return(res); } else { return(null); } }
//マップサイズ変更 void ResizeMap() { MapTips newMapTips3 = CreateInstance <MapTips>(); newMapTips3.Init(m_mapSizeX, m_mapSizeY, m_mapSizeZ); for (int x = 0; x < m_mapTips.mapSizeX; ++x) { if (x >= m_mapSizeX) { continue; } for (int y = 0; y < m_mapTips.mapSizeY; ++y) { if (y >= m_mapSizeY) { continue; } for (int z = 0; z < m_mapTips.mapSizeZ; ++z) { if (z >= m_mapSizeZ) { continue; } newMapTips3.SetEvent(m_mapTips.GetEvent(x, y, z), x, y, z); newMapTips3.SetShape(m_mapTips.GetShape(x, y, z), x, y, z); } } } m_mapTips = newMapTips3; OpenMapEditor(); }