public void ShrinkZ(int lineZ, int length) { MapTips res = CreateInstance <MapTips>(); res.Init(mapSizeX, mapSizeY, mapSizeZ); for (int x = 0; x < mapSizeX; ++x) { for (int y = 0; y < mapSizeY; ++y) { for (int z = 0; z < mapSizeZ; ++z) { Vector3Int tagpos; if (z < lineZ) { tagpos = new Vector3Int(x, y, z); } else { tagpos = new Vector3Int(x, y, z + length); } res.SetShape(GetShape(tagpos), x, y, z); } } } this.shapes = res.shapes; }
//マップ作成 void CreateNewMap() { //palette_ = CreateInstance<MapPalette>(); m_mapTips = CreateInstance <MapTips>(); m_mapTips.Init(m_mapSizeX, m_mapSizeY, m_mapSizeZ); for (int x = 0; x < m_mapSizeX; ++x) { for (int y = 0; y < m_mapSizeY; ++y) { for (int z = 0; z < m_mapSizeZ; ++z) { //mapTips2[x, y, z] = 0; if ((y == 0) || (z == m_mapSizeZ - 1)) { SetMapShape(EnumShapeType.Box, x, y, z); } } } } m_isLoadMapTip = true; }
//マップサイズ変更 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(); }
//コピー public MapTips GetCopy(Vector3Int pos, Vector3Int size) { //MapTips res = new MapTips(size.x, size.y, size.z); MapTips res = CreateInstance <MapTips>(); res.Init(size.x, size.y, size.z); for (int x = 0; x < size.x; ++x) { for (int y = 0; y < size.y; ++y) { for (int z = 0; z < size.z; ++z) { Vector3Int tagpos = new Vector3Int(pos.x + x, pos.y + y, pos.z + z); // Assert.IsTrue(this.IsSafePos(tagpos)); // Debug.Log(tagpos + " shape" + GetShape(tagpos)); res.SetShape(GetShape(tagpos), x, y, z); // res.SetEvent(GetEvent(tagpos), tagpos); } } } return(res); }