public void RemoveQuadrant(Transform quadrant) { Quadrant quadrantHidden = usedQuadrants.Find(q => q.idQuadrant == quadrant); HideAllSectorsInQuadrant(quadrantHidden); usedQuadrants.Remove(quadrantHidden); }
private void HideAllSectorsInQuadrant(Quadrant quadrant) { foreach (var item in quadrant.sectors) { if (SceneManager.GetSceneByName(item.idSector).isLoaded) { GameObject rootSector = SceneManager.GetSceneByName(item.idSector).GetRootGameObjects()[0]; if (rootSector.activeSelf) { HideScene(rootSector, Vector3.zero, Vector3.zero); } } } }
private void LoadSectors() { foreach (var item in scene.scene) { Quadrant quadrant = new Quadrant(); quadrant.idQuadrant = transform.Find(item.idQuadrant); List <Sector> sectors = new List <Sector>(); foreach (var sect in item.sectors) { Sector sector = new Sector(); string[] pos = sect.Split('_'); Vector3 position = new Vector3(GetPositionFromCoordinate(pos[1]), 0, GetPositionFromCoordinate(pos[2])); sector.idSector = sect; sector.position = position; sectors.Add(sector); } quadrant.sectors = sectors; quadrants.Add(quadrant); } }