TopDown Engine v4.5
Loading...
Searching...
No Matches
MoreMountains.Tools.MMAdditiveSceneLoadingManager Class Reference

A class to load scenes using a loading screen instead of just the default API This is a new version of the classic LoadingSceneManager (now renamed to MMSceneLoadingManager for consistency) More...

Inheritance diagram for MoreMountains.Tools.MMAdditiveSceneLoadingManager:
MoreMountains.Tools.MMMonoBehaviour

Public Types

enum  FadeModes { FadeInThenOut , FadeOutThenIn }
 The possible orders in which to play fades (depends on the fade you've set in your loading screen. More...
enum  HoldModes { AfterEntryFade , AfterUnloadOriginScene , BeforeSceneActivation , BeforeExitFade }

Static Public Member Functions

static void LoadScene (string sceneToLoadName, MMAdditiveSceneLoadingManagerSettings settings)
 Call this static method to load a scene from anywhere (packed settings signature)
static void LoadScene (string sceneToLoadName, string loadingSceneName="MMAdditiveLoadingScreen", ThreadPriority threadPriority=ThreadPriority.High, bool secureLoad=true, bool interpolateProgress=true, float beforeEntryFadeDelay=0f, float entryFadeDuration=0.25f, float afterEntryFadeDelay=0.1f, float beforeSceneActivationDelay=0.25f, float afterSceneActivationDelay=0f, float exitFadeDuration=0.2f, MMTweenType entryFadeTween=null, MMTweenType exitFadeTween=null, float progressBarSpeed=5f, FadeModes fadeMode=FadeModes.FadeInThenOut, MMAdditiveSceneLoadingManagerSettings.UnloadMethods unloadMethod=MMAdditiveSceneLoadingManagerSettings.UnloadMethods.AllScenes, string antiSpillSceneName="", List< MMSceneLoadingSpeedInterval > speedIntervals=null, bool debugMode=false)
 Call this static method to load a scene from anywhere.
static void SetHold (HoldModes holdMode, bool state)
static void ClearHolds ()
static float ComputeInterpolationSpeed (float t)
 Computes the interpolation speed to apply for a specific progress time.

Public Attributes

AudioListener LoadingAudioListener
int FaderID = 500
 the ID on which to trigger a fade, has to match the ID on the fader in your scene
ProgressEvent SetRealtimeProgressValue
 an event used to update progress
ProgressEvent SetInterpolatedProgressValue
 an event used to update progress with interpolation
UnityEvent OnLoadStarted
 an event that will be invoked when the load starts
UnityEvent OnBeforeEntryFade
 an event that will be invoked when the delay before the entry fade starts
UnityEvent OnEntryFade
 an event that will be invoked when the entry fade starts
UnityEvent OnAfterEntryFade
 an event that will be invoked when the delay after the entry fade starts
UnityEvent OnUnloadOriginScene
 an event that will be invoked when the origin scene gets unloaded
UnityEvent OnLoadDestinationScene
 an event that will be invoked when the destination scene starts loading
UnityEvent OnLoadProgressComplete
 an event that will be invoked when the load of the destination scene is complete
UnityEvent OnInterpolatedLoadProgressComplete
 an event that will be invoked when the interpolated load of the destination scene is complete
UnityEvent OnBeforeSceneActivation
 an event that will be invoked when the delay before scene activation starts
UnityEvent OnAfterSceneActivation
 an event that will be invoked after the scene has been activated
UnityEvent OnExitFade
 an event that will be invoked when the exit fade starts
UnityEvent OnDestinationSceneActivation
 an event that will be invoked when the destination scene gets activated
UnityEvent OnUnloadSceneLoader
 an event that will be invoked when the scene loader gets unloaded

Static Public Attributes

static bool DebugMode = false
 whether or not to output debug messages to the console

Protected Member Functions

virtual void Awake ()
 Starts loading the new level asynchronously.
virtual void Initialization ()
 Initializes timescale, computes null checks, and starts the load sequence.
virtual void Update ()
 Every frame, we fill the bar smoothly according to loading progress.
virtual void UpdateProgress ()
 Sends progress value via UnityEvents.
virtual IEnumerator LoadSequence ()
 Loads the scene to load asynchronously.
virtual void InitiateLoad ()
 Initializes counters and timescale.
virtual IEnumerator ProcessDelayBeforeEntryFade ()
 Waits for the specified BeforeEntryFadeDelay duration.
virtual IEnumerator EntryFade ()
 Calls a fader on entry.
virtual IEnumerator ProcessDelayAfterEntryFade ()
 Waits for the specified AfterEntryFadeDelay.
virtual IEnumerator UnloadOriginScenes ()
 Unloads the original scene(s) and waits for the unload to complete.
virtual IEnumerator LoadDestinationScene ()
 Loads the destination scene.
virtual IEnumerator ProcessDelayBeforeSceneActivation ()
 Waits for BeforeSceneActivation seconds.
virtual IEnumerator DestinationSceneActivation ()
 Activates the destination scene.
virtual IEnumerator ProcessDelayAfterSceneActivation ()
virtual IEnumerator ExitFade ()
 Requests a fade on exit.
virtual void OnLoadOperationComplete (AsyncOperation obj)
 A method triggered when the async operation completes.
virtual IEnumerator UnloadSceneLoader ()
 Unloads the scene loader.
virtual void SetAudioListener (bool state)
 Turns the loading audio listener on or off.
virtual void OnDestroy ()
 On Destroy we reset our state.
virtual void MMLoadingSceneDebug (string message)
 A debug method used to output console messages, for this class only.

Static Protected Member Functions

static void InitializeStatics ()
 Statics initialization to support enter play modes.

Protected Attributes

float _loadProgress = 0f
float _interpolatedLoadProgress
AsyncOperation _unloadOriginAsyncOperation
AsyncOperation _loadDestinationAsyncOperation
AsyncOperation _unloadLoadingAsyncOperation
bool _setRealtimeProgressValueIsNull
bool _setInterpolatedProgressValueIsNull
MMSceneLoadingAntiSpill _antiSpill = new MMSceneLoadingAntiSpill()

Static Protected Attributes

static bool _interpolateProgress
static float _progressInterpolationSpeed
static List< MMSceneLoadingSpeedInterval_speedIntervals
static float _beforeEntryFadeDelay
static MMTweenType _entryFadeTween
static float _entryFadeDuration
static float _afterEntryFadeDelay
static float _beforeSceneActivationDelay
static float _afterSceneActivationDelay
static MMTweenType _exitFadeTween
static float _exitFadeDuration
static FadeModes _fadeMode
static string _sceneToLoadName = ""
static string _loadingScreenSceneName
static List< string > _scenesInBuild
static Scene[] _initialScenes
static bool _loadingInProgress = false
const float _asyncProgressLimit = 0.9f
static string _antiSpillSceneName = ""
static Dictionary< HoldModes, bool > _holds

Detailed Description

A class to load scenes using a loading screen instead of just the default API This is a new version of the classic LoadingSceneManager (now renamed to MMSceneLoadingManager for consistency)

Member Enumeration Documentation

◆ FadeModes

The possible orders in which to play fades (depends on the fade you've set in your loading screen.

Enumerator
FadeInThenOut 
FadeOutThenIn 

◆ HoldModes

Enumerator
AfterEntryFade 
AfterUnloadOriginScene 
BeforeSceneActivation 
BeforeExitFade 

Member Function Documentation

◆ Awake()

virtual void MoreMountains.Tools.MMAdditiveSceneLoadingManager.Awake ( )
protectedvirtual

Starts loading the new level asynchronously.

◆ ClearHolds()

void MoreMountains.Tools.MMAdditiveSceneLoadingManager.ClearHolds ( )
static

◆ ComputeInterpolationSpeed()

float MoreMountains.Tools.MMAdditiveSceneLoadingManager.ComputeInterpolationSpeed ( float t)
static

Computes the interpolation speed to apply for a specific progress time.

Parameters
t
Returns

◆ DestinationSceneActivation()

virtual IEnumerator MoreMountains.Tools.MMAdditiveSceneLoadingManager.DestinationSceneActivation ( )
protectedvirtual

Activates the destination scene.

◆ EntryFade()

virtual IEnumerator MoreMountains.Tools.MMAdditiveSceneLoadingManager.EntryFade ( )
protectedvirtual

Calls a fader on entry.

Returns

◆ ExitFade()

virtual IEnumerator MoreMountains.Tools.MMAdditiveSceneLoadingManager.ExitFade ( )
protectedvirtual

Requests a fade on exit.

Returns

◆ Initialization()

virtual void MoreMountains.Tools.MMAdditiveSceneLoadingManager.Initialization ( )
protectedvirtual

Initializes timescale, computes null checks, and starts the load sequence.

◆ InitializeStatics()

void MoreMountains.Tools.MMAdditiveSceneLoadingManager.InitializeStatics ( )
staticprotected

Statics initialization to support enter play modes.

◆ InitiateLoad()

virtual void MoreMountains.Tools.MMAdditiveSceneLoadingManager.InitiateLoad ( )
protectedvirtual

Initializes counters and timescale.

◆ LoadDestinationScene()

virtual IEnumerator MoreMountains.Tools.MMAdditiveSceneLoadingManager.LoadDestinationScene ( )
protectedvirtual

Loads the destination scene.

Returns

◆ LoadScene() [1/2]

void MoreMountains.Tools.MMAdditiveSceneLoadingManager.LoadScene ( string sceneToLoadName,
MMAdditiveSceneLoadingManagerSettings settings )
static

Call this static method to load a scene from anywhere (packed settings signature)

Parameters
sceneToLoadName
settings

◆ LoadScene() [2/2]

void MoreMountains.Tools.MMAdditiveSceneLoadingManager.LoadScene ( string sceneToLoadName,
string loadingSceneName = "MMAdditiveLoadingScreen",
ThreadPriority threadPriority = ThreadPriority::High,
bool secureLoad = true,
bool interpolateProgress = true,
float beforeEntryFadeDelay = 0f,
float entryFadeDuration = 0::25f,
float afterEntryFadeDelay = 0::1f,
float beforeSceneActivationDelay = 0::25f,
float afterSceneActivationDelay = 0f,
float exitFadeDuration = 0::2f,
MMTweenType entryFadeTween = null,
MMTweenType exitFadeTween = null,
float progressBarSpeed = 5f,
FadeModes fadeMode = FadeModes::FadeInThenOut,
MMAdditiveSceneLoadingManagerSettings.UnloadMethods unloadMethod = MMAdditiveSceneLoadingManagerSettings::UnloadMethods::AllScenes,
string antiSpillSceneName = "",
List< MMSceneLoadingSpeedInterval > speedIntervals = null,
bool debugMode = false )
static

Call this static method to load a scene from anywhere.

Parameters
sceneToLoadNameLevel name.

◆ LoadSequence()

virtual IEnumerator MoreMountains.Tools.MMAdditiveSceneLoadingManager.LoadSequence ( )
protectedvirtual

Loads the scene to load asynchronously.

◆ MMLoadingSceneDebug()

virtual void MoreMountains.Tools.MMAdditiveSceneLoadingManager.MMLoadingSceneDebug ( string message)
protectedvirtual

A debug method used to output console messages, for this class only.

Parameters
message

◆ OnDestroy()

virtual void MoreMountains.Tools.MMAdditiveSceneLoadingManager.OnDestroy ( )
protectedvirtual

On Destroy we reset our state.

◆ OnLoadOperationComplete()

virtual void MoreMountains.Tools.MMAdditiveSceneLoadingManager.OnLoadOperationComplete ( AsyncOperation obj)
protectedvirtual

A method triggered when the async operation completes.

Parameters
obj

◆ ProcessDelayAfterEntryFade()

virtual IEnumerator MoreMountains.Tools.MMAdditiveSceneLoadingManager.ProcessDelayAfterEntryFade ( )
protectedvirtual

Waits for the specified AfterEntryFadeDelay.

Returns

◆ ProcessDelayAfterSceneActivation()

virtual IEnumerator MoreMountains.Tools.MMAdditiveSceneLoadingManager.ProcessDelayAfterSceneActivation ( )
protectedvirtual

◆ ProcessDelayBeforeEntryFade()

virtual IEnumerator MoreMountains.Tools.MMAdditiveSceneLoadingManager.ProcessDelayBeforeEntryFade ( )
protectedvirtual

Waits for the specified BeforeEntryFadeDelay duration.

Returns

◆ ProcessDelayBeforeSceneActivation()

virtual IEnumerator MoreMountains.Tools.MMAdditiveSceneLoadingManager.ProcessDelayBeforeSceneActivation ( )
protectedvirtual

Waits for BeforeSceneActivation seconds.

Returns

◆ SetAudioListener()

virtual void MoreMountains.Tools.MMAdditiveSceneLoadingManager.SetAudioListener ( bool state)
protectedvirtual

Turns the loading audio listener on or off.

Parameters
state

◆ SetHold()

void MoreMountains.Tools.MMAdditiveSceneLoadingManager.SetHold ( HoldModes holdMode,
bool state )
static

◆ UnloadOriginScenes()

virtual IEnumerator MoreMountains.Tools.MMAdditiveSceneLoadingManager.UnloadOriginScenes ( )
protectedvirtual

Unloads the original scene(s) and waits for the unload to complete.

Returns

◆ UnloadSceneLoader()

virtual IEnumerator MoreMountains.Tools.MMAdditiveSceneLoadingManager.UnloadSceneLoader ( )
protectedvirtual

Unloads the scene loader.

Returns

◆ Update()

virtual void MoreMountains.Tools.MMAdditiveSceneLoadingManager.Update ( )
protectedvirtual

Every frame, we fill the bar smoothly according to loading progress.

◆ UpdateProgress()

virtual void MoreMountains.Tools.MMAdditiveSceneLoadingManager.UpdateProgress ( )
protectedvirtual

Sends progress value via UnityEvents.

Member Data Documentation

◆ _afterEntryFadeDelay

float MoreMountains.Tools.MMAdditiveSceneLoadingManager._afterEntryFadeDelay
staticprotected

◆ _afterSceneActivationDelay

float MoreMountains.Tools.MMAdditiveSceneLoadingManager._afterSceneActivationDelay
staticprotected

◆ _antiSpill

MMSceneLoadingAntiSpill MoreMountains.Tools.MMAdditiveSceneLoadingManager._antiSpill = new MMSceneLoadingAntiSpill()
protected

◆ _antiSpillSceneName

string MoreMountains.Tools.MMAdditiveSceneLoadingManager._antiSpillSceneName = ""
staticprotected

◆ _asyncProgressLimit

const float MoreMountains.Tools.MMAdditiveSceneLoadingManager._asyncProgressLimit = 0.9f
staticprotected

◆ _beforeEntryFadeDelay

float MoreMountains.Tools.MMAdditiveSceneLoadingManager._beforeEntryFadeDelay
staticprotected

◆ _beforeSceneActivationDelay

float MoreMountains.Tools.MMAdditiveSceneLoadingManager._beforeSceneActivationDelay
staticprotected

◆ _entryFadeDuration

float MoreMountains.Tools.MMAdditiveSceneLoadingManager._entryFadeDuration
staticprotected

◆ _entryFadeTween

MMTweenType MoreMountains.Tools.MMAdditiveSceneLoadingManager._entryFadeTween
staticprotected

◆ _exitFadeDuration

float MoreMountains.Tools.MMAdditiveSceneLoadingManager._exitFadeDuration
staticprotected

◆ _exitFadeTween

MMTweenType MoreMountains.Tools.MMAdditiveSceneLoadingManager._exitFadeTween
staticprotected

◆ _fadeMode

FadeModes MoreMountains.Tools.MMAdditiveSceneLoadingManager._fadeMode
staticprotected

◆ _holds

Dictionary<HoldModes, bool> MoreMountains.Tools.MMAdditiveSceneLoadingManager._holds
staticprotected
Initial value:
= new Dictionary<HoldModes, bool>
{
{HoldModes.AfterEntryFade, false},
{HoldModes.AfterUnloadOriginScene, false},
{HoldModes.BeforeSceneActivation, false},
{HoldModes.BeforeExitFade, false}
}
HoldModes
Definition MMAdditiveSceneLoadingManager.cs:114

◆ _initialScenes

Scene [] MoreMountains.Tools.MMAdditiveSceneLoadingManager._initialScenes
staticprotected

◆ _interpolatedLoadProgress

float MoreMountains.Tools.MMAdditiveSceneLoadingManager._interpolatedLoadProgress
protected

◆ _interpolateProgress

bool MoreMountains.Tools.MMAdditiveSceneLoadingManager._interpolateProgress
staticprotected

◆ _loadDestinationAsyncOperation

AsyncOperation MoreMountains.Tools.MMAdditiveSceneLoadingManager._loadDestinationAsyncOperation
protected

◆ _loadingInProgress

bool MoreMountains.Tools.MMAdditiveSceneLoadingManager._loadingInProgress = false
staticprotected

◆ _loadingScreenSceneName

string MoreMountains.Tools.MMAdditiveSceneLoadingManager._loadingScreenSceneName
staticprotected

◆ _loadProgress

float MoreMountains.Tools.MMAdditiveSceneLoadingManager._loadProgress = 0f
protected

◆ _progressInterpolationSpeed

float MoreMountains.Tools.MMAdditiveSceneLoadingManager._progressInterpolationSpeed
staticprotected

◆ _scenesInBuild

List<string> MoreMountains.Tools.MMAdditiveSceneLoadingManager._scenesInBuild
staticprotected

◆ _sceneToLoadName

string MoreMountains.Tools.MMAdditiveSceneLoadingManager._sceneToLoadName = ""
staticprotected

◆ _setInterpolatedProgressValueIsNull

bool MoreMountains.Tools.MMAdditiveSceneLoadingManager._setInterpolatedProgressValueIsNull
protected

◆ _setRealtimeProgressValueIsNull

bool MoreMountains.Tools.MMAdditiveSceneLoadingManager._setRealtimeProgressValueIsNull
protected

◆ _speedIntervals

List<MMSceneLoadingSpeedInterval> MoreMountains.Tools.MMAdditiveSceneLoadingManager._speedIntervals
staticprotected

◆ _unloadLoadingAsyncOperation

AsyncOperation MoreMountains.Tools.MMAdditiveSceneLoadingManager._unloadLoadingAsyncOperation
protected

◆ _unloadOriginAsyncOperation

AsyncOperation MoreMountains.Tools.MMAdditiveSceneLoadingManager._unloadOriginAsyncOperation
protected

◆ DebugMode

bool MoreMountains.Tools.MMAdditiveSceneLoadingManager.DebugMode = false
static

whether or not to output debug messages to the console

◆ FaderID

int MoreMountains.Tools.MMAdditiveSceneLoadingManager.FaderID = 500

the ID on which to trigger a fade, has to match the ID on the fader in your scene

◆ LoadingAudioListener

AudioListener MoreMountains.Tools.MMAdditiveSceneLoadingManager.LoadingAudioListener

◆ OnAfterEntryFade

UnityEvent MoreMountains.Tools.MMAdditiveSceneLoadingManager.OnAfterEntryFade

an event that will be invoked when the delay after the entry fade starts

◆ OnAfterSceneActivation

UnityEvent MoreMountains.Tools.MMAdditiveSceneLoadingManager.OnAfterSceneActivation

an event that will be invoked after the scene has been activated

◆ OnBeforeEntryFade

UnityEvent MoreMountains.Tools.MMAdditiveSceneLoadingManager.OnBeforeEntryFade

an event that will be invoked when the delay before the entry fade starts

◆ OnBeforeSceneActivation

UnityEvent MoreMountains.Tools.MMAdditiveSceneLoadingManager.OnBeforeSceneActivation

an event that will be invoked when the delay before scene activation starts

◆ OnDestinationSceneActivation

UnityEvent MoreMountains.Tools.MMAdditiveSceneLoadingManager.OnDestinationSceneActivation

an event that will be invoked when the destination scene gets activated

◆ OnEntryFade

UnityEvent MoreMountains.Tools.MMAdditiveSceneLoadingManager.OnEntryFade

an event that will be invoked when the entry fade starts

◆ OnExitFade

UnityEvent MoreMountains.Tools.MMAdditiveSceneLoadingManager.OnExitFade

an event that will be invoked when the exit fade starts

◆ OnInterpolatedLoadProgressComplete

UnityEvent MoreMountains.Tools.MMAdditiveSceneLoadingManager.OnInterpolatedLoadProgressComplete

an event that will be invoked when the interpolated load of the destination scene is complete

◆ OnLoadDestinationScene

UnityEvent MoreMountains.Tools.MMAdditiveSceneLoadingManager.OnLoadDestinationScene

an event that will be invoked when the destination scene starts loading

◆ OnLoadProgressComplete

UnityEvent MoreMountains.Tools.MMAdditiveSceneLoadingManager.OnLoadProgressComplete

an event that will be invoked when the load of the destination scene is complete

◆ OnLoadStarted

UnityEvent MoreMountains.Tools.MMAdditiveSceneLoadingManager.OnLoadStarted

an event that will be invoked when the load starts

◆ OnUnloadOriginScene

UnityEvent MoreMountains.Tools.MMAdditiveSceneLoadingManager.OnUnloadOriginScene

an event that will be invoked when the origin scene gets unloaded

◆ OnUnloadSceneLoader

UnityEvent MoreMountains.Tools.MMAdditiveSceneLoadingManager.OnUnloadSceneLoader

an event that will be invoked when the scene loader gets unloaded

◆ SetInterpolatedProgressValue

ProgressEvent MoreMountains.Tools.MMAdditiveSceneLoadingManager.SetInterpolatedProgressValue

an event used to update progress with interpolation

◆ SetRealtimeProgressValue

ProgressEvent MoreMountains.Tools.MMAdditiveSceneLoadingManager.SetRealtimeProgressValue

an event used to update progress


The documentation for this class was generated from the following file:
  • H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/ThirdParty/MoreMountains/MMTools/Core/MMSceneLoading/Scripts/Managers/MMAdditiveSceneLoadingManager.cs