TopDown Engine  v4.1
MoreMountains.TopDownEngine.LevelManager Class Reference

Spawns the player, handles checkpoints and respawn More...

Inheritance diagram for MoreMountains.TopDownEngine.LevelManager:
MoreMountains.Tools.MMSingleton< LevelManager > MoreMountains.Tools.MMEventListener< TopDownEngineEvent > MoreMountains.TopDownEngine.MultiplayerLevelManager MoreMountains.TopDownEngine.ExplodudesMultiplayerLevelManager MoreMountains.TopDownEngine.GrasslandsMultiplayerLevelManager

Public Member Functions

virtual void GotoLevel (string levelName)
 Gets the player to the specified level More...
 
virtual void TriggerEndLevelEvents ()
 Triggers end of level events More...
 
virtual void PlayerDead (Character playerCharacter)
 Kills the player. More...
 
virtual void ToggleCharacterPause ()
 Toggles Character Pause More...
 
virtual void FreezeCharacters ()
 Freezes the character(s) More...
 
virtual void UnFreezeCharacters ()
 Unfreezes the character(s) More...
 
virtual void SetCurrentCheckpoint (CheckPoint newCheckPoint)
 Sets the current checkpoint with the one set in parameter. This checkpoint will be saved and used should the player die. More...
 
virtual void OnMMEvent (TopDownEngineEvent engineEvent)
 Catches TopDownEngineEvents and acts on them, playing the corresponding sounds More...
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< TopDownEngineEvent >
void OnMMEvent (T eventType)
 

Public Attributes

bool AutoAttributePlayerIDs = true
 the prefab you want for your player More...
 
Character[] PlayerPrefabs
 the list of player prefabs to instantiate More...
 
List< CharacterSceneCharacters
 a list of Characters already present in the scene before runtime. If this list is filled, PlayerPrefabs will be ignored More...
 
CheckPoint InitialSpawnPoint
 the checkpoint to use as initial spawn point if no point of entry is specified More...
 
CheckPoint CurrentCheckpoint
 the currently active checkpoint (the last checkpoint passed by the player) More...
 
Transform[] PointsOfEntry
 A list of this level's points of entry, which can be used from other levels as initial targets. More...
 
float IntroFadeDuration =1f
 duration of the initial fade in (in seconds) More...
 
float SpawnDelay = 0f
 
float OutroFadeDuration =1f
 duration of the fade to black at the end of the level (in seconds) More...
 
int FaderID = 0
 the ID to use when triggering the event (should match the ID on the fader you want to use) More...
 
MMTweenType FadeCurve = new MMTweenType(MMTween.MMTweenCurve.EaseInOutCubic)
 the curve to use for in and out fades More...
 
float RespawnDelay = 2f
 duration between a death of the main character and its respawn More...
 
float DelayBeforeDeathScreen = 1f
 the delay, in seconds, before displaying the death screen once the player is dead More...
 
bool UseLevelBounds = true
 if this is true, this level will use the level bounds defined on this LevelManager. Set it to false when using the Rooms system. More...
 
MMLoadScene.LoadingSceneModes LoadingSceneMode = MMLoadScene.LoadingSceneModes.MMSceneLoadingManager
 the method to use to load the destination level More...
 
string LoadingSceneName = "LoadingScreen"
 the name of the MMSceneLoadingManager scene you want to use More...
 
MMAdditiveSceneLoadingManagerSettings AdditiveLoadingSettings
 the settings to use when loading the scene in additive mode More...
 
bool SetPlayerAsFeedbackRangeCenter = false
 if this is true, an event will be triggered on player instantiation to set the range target of all feedbacks to it More...
 

Protected Member Functions

override void Awake ()
 On awake, instantiates the player More...
 
virtual void Start ()
 On Start we grab our dependencies and initialize spawn More...
 
virtual IEnumerator InitializationCoroutine ()
 
virtual void SpawnMultipleCharacters ()
 A method meant to be overridden by each multiplayer level manager to describe how to spawn characters More...
 
virtual void InstantiatePlayableCharacters ()
 Instantiate playable characters based on the ones specified in the PlayerPrefabs list in the LevelManager's inspector. More...
 
virtual void CheckpointAssignment ()
 Assigns all respawnable objects in the scene to their checkpoint More...
 
virtual void Initialization ()
 Gets current camera, points number, start time, etc. More...
 
virtual void SpawnSingleCharacter ()
 Spawns a playable character into the scene More...
 
virtual IEnumerator GotoLevelCo (string levelName)
 Waits for a short time and then loads the specified level More...
 
virtual IEnumerator PlayerDeadCo ()
 Triggers the death screen display after a short delay More...
 
virtual void Respawn ()
 Initiates the respawn More...
 
virtual IEnumerator SoloModeRestart ()
 Coroutine that kills the player, stops the camera, resets the points. More...
 
virtual void OnEnable ()
 OnDisable, we start listening to events. More...
 
virtual void OnDisable ()
 OnDisable, we stop listening to events. More...
 
- Protected Member Functions inherited from MoreMountains.Tools.MMSingleton< LevelManager >
virtual void InitializeSingleton ()
 Initializes the singleton. More...
 

Static Protected Member Functions

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

Protected Attributes

DateTime _started
 
int _savedPoints
 
Collider _collider
 
Collider2D _collider2D
 
Vector3 _initialSpawnPointPosition
 

Properties

virtual Bounds? LevelBounds [get]
 the level limits, camera and player won't go beyond this point. More...
 
virtual Collider BoundsCollider [get, protected set]
 
virtual Collider2D BoundsCollider2D [get, protected set]
 
virtual TimeSpan RunningTime [get]
 the elapsed time since the start of the level More...
 
virtual List< CheckPointCheckpoints [get, protected set]
 
virtual List< CharacterPlayers [get, protected set]
 
- Properties inherited from MoreMountains.Tools.MMSingleton< LevelManager >
static T Instance [get]
 Singleton design pattern More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MoreMountains.Tools.MMSingleton< LevelManager >
static T TryGetInstance ()
 
- Static Public Attributes inherited from MoreMountains.Tools.MMSingleton< LevelManager >
static bool HasInstance
 
static T Current
 
- Static Protected Attributes inherited from MoreMountains.Tools.MMSingleton< LevelManager >
static T _instance
 

Detailed Description

Spawns the player, handles checkpoints and respawn

Member Function Documentation

◆ Awake()

override void MoreMountains.TopDownEngine.LevelManager.Awake ( )
protectedvirtual

On awake, instantiates the player

Reimplemented from MoreMountains.Tools.MMSingleton< LevelManager >.

Reimplemented in MoreMountains.TopDownEngine.MultiplayerLevelManager.

◆ CheckpointAssignment()

virtual void MoreMountains.TopDownEngine.LevelManager.CheckpointAssignment ( )
protectedvirtual

Assigns all respawnable objects in the scene to their checkpoint

◆ FreezeCharacters()

virtual void MoreMountains.TopDownEngine.LevelManager.FreezeCharacters ( )
virtual

Freezes the character(s)

◆ GotoLevel()

virtual void MoreMountains.TopDownEngine.LevelManager.GotoLevel ( string  levelName)
virtual

Gets the player to the specified level

Parameters
levelNameLevel name.

◆ GotoLevelCo()

virtual IEnumerator MoreMountains.TopDownEngine.LevelManager.GotoLevelCo ( string  levelName)
protectedvirtual

Waits for a short time and then loads the specified level

Returns
The level co.
Parameters
levelNameLevel name.

◆ Initialization()

virtual void MoreMountains.TopDownEngine.LevelManager.Initialization ( )
protectedvirtual

◆ InitializationCoroutine()

virtual IEnumerator MoreMountains.TopDownEngine.LevelManager.InitializationCoroutine ( )
protectedvirtual

◆ InitializeStatics()

static void MoreMountains.TopDownEngine.LevelManager.InitializeStatics ( )
staticprotected

Statics initialization to support enter play modes

◆ InstantiatePlayableCharacters()

virtual void MoreMountains.TopDownEngine.LevelManager.InstantiatePlayableCharacters ( )
protectedvirtual

Instantiate playable characters based on the ones specified in the PlayerPrefabs list in the LevelManager's inspector.

◆ OnDisable()

virtual void MoreMountains.TopDownEngine.LevelManager.OnDisable ( )
protectedvirtual

◆ OnEnable()

virtual void MoreMountains.TopDownEngine.LevelManager.OnEnable ( )
protectedvirtual

◆ OnMMEvent()

virtual void MoreMountains.TopDownEngine.LevelManager.OnMMEvent ( TopDownEngineEvent  engineEvent)
virtual

Catches TopDownEngineEvents and acts on them, playing the corresponding sounds

Parameters
engineEventTopDownEngineEvent event.

◆ PlayerDead()

virtual void MoreMountains.TopDownEngine.LevelManager.PlayerDead ( Character  playerCharacter)
virtual

Kills the player.

Reimplemented in MoreMountains.TopDownEngine.MultiplayerLevelManager.

◆ PlayerDeadCo()

virtual IEnumerator MoreMountains.TopDownEngine.LevelManager.PlayerDeadCo ( )
protectedvirtual

Triggers the death screen display after a short delay

Returns

◆ Respawn()

virtual void MoreMountains.TopDownEngine.LevelManager.Respawn ( )
protectedvirtual

Initiates the respawn

◆ SetCurrentCheckpoint()

virtual void MoreMountains.TopDownEngine.LevelManager.SetCurrentCheckpoint ( CheckPoint  newCheckPoint)
virtual

Sets the current checkpoint with the one set in parameter. This checkpoint will be saved and used should the player die.

Parameters
newCheckPoint

◆ SoloModeRestart()

virtual IEnumerator MoreMountains.TopDownEngine.LevelManager.SoloModeRestart ( )
protectedvirtual

Coroutine that kills the player, stops the camera, resets the points.

Returns
The player co.

◆ SpawnMultipleCharacters()

virtual void MoreMountains.TopDownEngine.LevelManager.SpawnMultipleCharacters ( )
protectedvirtual

A method meant to be overridden by each multiplayer level manager to describe how to spawn characters

Reimplemented in MoreMountains.TopDownEngine.MultiplayerLevelManager.

◆ SpawnSingleCharacter()

virtual void MoreMountains.TopDownEngine.LevelManager.SpawnSingleCharacter ( )
protectedvirtual

Spawns a playable character into the scene

◆ Start()

virtual void MoreMountains.TopDownEngine.LevelManager.Start ( )
protectedvirtual

On Start we grab our dependencies and initialize spawn

◆ ToggleCharacterPause()

virtual void MoreMountains.TopDownEngine.LevelManager.ToggleCharacterPause ( )
virtual

Toggles Character Pause

◆ TriggerEndLevelEvents()

virtual void MoreMountains.TopDownEngine.LevelManager.TriggerEndLevelEvents ( )
virtual

Triggers end of level events

◆ UnFreezeCharacters()

virtual void MoreMountains.TopDownEngine.LevelManager.UnFreezeCharacters ( )
virtual

Unfreezes the character(s)

Member Data Documentation

◆ _collider

Collider MoreMountains.TopDownEngine.LevelManager._collider
protected

◆ _collider2D

Collider2D MoreMountains.TopDownEngine.LevelManager._collider2D
protected

◆ _initialSpawnPointPosition

Vector3 MoreMountains.TopDownEngine.LevelManager._initialSpawnPointPosition
protected

◆ _savedPoints

int MoreMountains.TopDownEngine.LevelManager._savedPoints
protected

◆ _started

DateTime MoreMountains.TopDownEngine.LevelManager._started
protected

◆ AdditiveLoadingSettings

MMAdditiveSceneLoadingManagerSettings MoreMountains.TopDownEngine.LevelManager.AdditiveLoadingSettings

the settings to use when loading the scene in additive mode

◆ AutoAttributePlayerIDs

bool MoreMountains.TopDownEngine.LevelManager.AutoAttributePlayerIDs = true

the prefab you want for your player

should the player IDs be auto attributed (usually yes)

◆ CurrentCheckpoint

CheckPoint MoreMountains.TopDownEngine.LevelManager.CurrentCheckpoint

the currently active checkpoint (the last checkpoint passed by the player)

◆ DelayBeforeDeathScreen

float MoreMountains.TopDownEngine.LevelManager.DelayBeforeDeathScreen = 1f

the delay, in seconds, before displaying the death screen once the player is dead

◆ FadeCurve

MMTweenType MoreMountains.TopDownEngine.LevelManager.FadeCurve = new MMTweenType(MMTween.MMTweenCurve.EaseInOutCubic)

the curve to use for in and out fades

◆ FaderID

int MoreMountains.TopDownEngine.LevelManager.FaderID = 0

the ID to use when triggering the event (should match the ID on the fader you want to use)

◆ InitialSpawnPoint

CheckPoint MoreMountains.TopDownEngine.LevelManager.InitialSpawnPoint

the checkpoint to use as initial spawn point if no point of entry is specified

◆ IntroFadeDuration

float MoreMountains.TopDownEngine.LevelManager.IntroFadeDuration =1f

duration of the initial fade in (in seconds)

◆ LoadingSceneMode

MMLoadScene.LoadingSceneModes MoreMountains.TopDownEngine.LevelManager.LoadingSceneMode = MMLoadScene.LoadingSceneModes.MMSceneLoadingManager

the method to use to load the destination level

◆ LoadingSceneName

string MoreMountains.TopDownEngine.LevelManager.LoadingSceneName = "LoadingScreen"

the name of the MMSceneLoadingManager scene you want to use

◆ OutroFadeDuration

float MoreMountains.TopDownEngine.LevelManager.OutroFadeDuration =1f

duration of the fade to black at the end of the level (in seconds)

◆ PlayerPrefabs

Character [] MoreMountains.TopDownEngine.LevelManager.PlayerPrefabs

the list of player prefabs to instantiate

◆ PointsOfEntry

Transform [] MoreMountains.TopDownEngine.LevelManager.PointsOfEntry

A list of this level's points of entry, which can be used from other levels as initial targets.

◆ RespawnDelay

float MoreMountains.TopDownEngine.LevelManager.RespawnDelay = 2f

duration between a death of the main character and its respawn

◆ SceneCharacters

List<Character> MoreMountains.TopDownEngine.LevelManager.SceneCharacters

a list of Characters already present in the scene before runtime. If this list is filled, PlayerPrefabs will be ignored

◆ SetPlayerAsFeedbackRangeCenter

bool MoreMountains.TopDownEngine.LevelManager.SetPlayerAsFeedbackRangeCenter = false

if this is true, an event will be triggered on player instantiation to set the range target of all feedbacks to it

◆ SpawnDelay

float MoreMountains.TopDownEngine.LevelManager.SpawnDelay = 0f

◆ UseLevelBounds

bool MoreMountains.TopDownEngine.LevelManager.UseLevelBounds = true

if this is true, this level will use the level bounds defined on this LevelManager. Set it to false when using the Rooms system.

Property Documentation

◆ BoundsCollider

virtual Collider MoreMountains.TopDownEngine.LevelManager.BoundsCollider
getprotected set

◆ BoundsCollider2D

virtual Collider2D MoreMountains.TopDownEngine.LevelManager.BoundsCollider2D
getprotected set

◆ Checkpoints

virtual List<CheckPoint> MoreMountains.TopDownEngine.LevelManager.Checkpoints
getprotected set

◆ LevelBounds

virtual Bounds? MoreMountains.TopDownEngine.LevelManager.LevelBounds
get

the level limits, camera and player won't go beyond this point.

◆ Players

virtual List<Character> MoreMountains.TopDownEngine.LevelManager.Players
getprotected set

◆ RunningTime

virtual TimeSpan MoreMountains.TopDownEngine.LevelManager.RunningTime
get

the elapsed time since the start of the level


The documentation for this class was generated from the following file: