public void Destroy() { if (m_roomObjectGenerator != null) { m_roomObjectGenerator.Destroy(); m_roomObjectGenerator = null; } if (m_corridorObjectGenerator != null) { m_corridorObjectGenerator.Destroy(); m_corridorObjectGenerator = null; } if (m_pillarObjectGenerator != null) { m_pillarObjectGenerator.Destroy(); m_pillarObjectGenerator = null; } }
public void Generate(Room[] rooms, Corridor[] corridors) { Destroy(); ConnectedCorridorService service = new ConnectedCorridorService(rooms, corridors); m_roomObjectGenerator = new RoomObjectGenerator(service.Rooms, m_objectReferences.RoomGroundRefs, m_objectReferences.RoomWallRefs); m_roomObjectGenerator.Parent.localScale = Vector3.one * m_gridSize; m_roomObjectGenerator.Parent.SetParent(m_parent); m_corridorObjectGenerator = new CorridorObjectGenerator(service.Roads, m_objectReferences.RoadGroundRefs, m_objectReferences.RoadWallRefs); m_corridorObjectGenerator.Parent.localScale = Vector3.one * m_gridSize; m_corridorObjectGenerator.Parent.SetParent(m_parent); List <Wall> walls = new List <Wall>(); walls.AddRange(m_roomObjectGenerator.WallList); walls.AddRange(m_corridorObjectGenerator.WallList); m_pillarObjectGenerator = new PillarObjectGenerator(m_mapSize, walls.ToArray(), m_objectReferences.PillarRefs); m_pillarObjectGenerator.Parent.localScale = Vector3.one * m_gridSize; m_pillarObjectGenerator.Parent.SetParent(m_parent); service = null; }