示例#1
0
 IEnumerator ClearRoutine()
 {
     _ready = false;
     if (usePathGeneratorInstance && overridePathGenerator != null)
     {
         Destroy(overridePathGenerator);
     }
     overridePathGenerator = null;
     while (isLoadingLevel)
     {
         yield return(null);
     }
     LevelSegment.ResetGenerationState();
     SegmentExtruder.instance.Stop();
     for (int i = 0; i < levels.Length; i++)
     {
         if (levels[i].remoteSequence && levels[i].isReady)
         {
             yield return(StartCoroutine(UnloadRemoteLevel(levels[i], ThreadPriority.High)));
         }
     }
     for (int i = 0; i < _segments.Count; i++)
     {
         _segments[i].DestroyImmediate();
     }
     ResourceManagement.UnloadResources();
     _segments.Clear();
     enteredLevel    = null;
     _enteredSegment = -1;
 }
示例#2
0
 protected virtual void OnDestroy()
 {
     //Destroy generated resources
     for (int i = 0; i < objectProperties.Length; i++)
     {
         objectProperties[i].Dispose();
     }
     //Unload assets used only by this segment and no upcoming segments
     ResourceManagement.UnloadResources(index);
     if (_generationState == GenerationState.Destroying)
     {
         _generationState = GenerationState.Idle;
     }
 }