public void UpdateVisibleSectors() { if (activeVisibleStrategy != CubeWorldPlayerPreferences.visibleStrategy || visibleStrategy == null) { Clear(); activeVisibleStrategy = CubeWorldPlayerPreferences.visibleStrategy; switch (activeVisibleStrategy) { case VisibleStrategy.Radius: this.visibleStrategy = new VisibleSectorsStrategyRadius(this, gameManagerUnity.world.sectorManager, gameManagerUnity.world.avatarManager.player, gameManagerUnity.playerUnity); break; case VisibleStrategy.All: this.visibleStrategy = new VisibleSectorsStrategyAll(this, gameManagerUnity.world.sectorManager); break; } } visibleStrategy.Update(); }
public void Clear() { foreach (SectorUnity unitySector in unitySectors) { GameObject.DestroyImmediate(unitySector.gameObject); } unitySectors.Clear(); cacheSectors.Clear(); lastSectorAssignmentCache.Clear(); if (goContainer) { GameObject.DestroyImmediate(goContainer); goContainer = null; } if (visibleStrategy != null) { visibleStrategy.Clear(); visibleStrategy = null; } }