Corgi Engine v9.4
Loading...
Searching...
No Matches
MoreMountains.CorgiEngine.LevelManager Class Reference

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

Inheritance diagram for MoreMountains.CorgiEngine.LevelManager:
MoreMountains.Tools.MMSingleton< T > MoreMountains.Tools.MMEventListener< T > MoreMountains.Tools.MMEventListenerBase MoreMountains.CorgiEngine.MultiplayerLevelManager

Public Types

enum  CheckpointsAxis { x , y , z , CheckpointOrder }
 the possible checkpoint axis More...
enum  CheckpointDirections { Ascending , Descending }
enum  BoundsModes { TwoD , ThreeD }

Public Member Functions

virtual void Start ()
 Initialization.
virtual void SetCurrentCheckpoint (CheckPoint newCheckPoint)
 Sets the current checkpoint.
virtual void SetNextLevel (string levelName)
 Sets the name of the next level this LevelManager will point to.
virtual void GotoNextLevel ()
 Loads the next level, as defined via the SetNextLevel method.
virtual void GotoLevel (string levelName, bool fadeOut=true, bool save=true)
 Gets the player to the specified level.
virtual void PlayerDead (Character player)
 Kills the player.
virtual void FreezeCharacters ()
 Freezes the character(s)
virtual void UnFreezeCharacters ()
 Unfreezes the character(s)
virtual void ToggleCharacterPause ()
 Toggles Character Pause.
virtual void ResetLevelBoundsToOriginalBounds ()
 Resets the level bounds to their initial value.
virtual void SetNewMinLevelBounds (Vector3 newMinBounds)
 Sets the level bound's min point to the one in parameters.
virtual void SetNewMaxLevelBounds (Vector3 newMaxBounds)
 Sets the level bound's max point to the one in parameters.
virtual void SetNewLevelBounds (Bounds newBounds)
 Sets the level bounds to the one passed in parameters.
virtual void OnMMEvent (CorgiEngineEvent engineEvent)
 Catches CorgiEngineEvents and acts on them, playing the corresponding sounds.
Public Member Functions inherited from MoreMountains.Tools.MMEventListener< T >
void OnMMEvent (T eventType)

Public Attributes

Character[] PlayerPrefabs
 the prefab you want for your player
bool AutoAttributePlayerIDs = true
 should the player IDs be auto attributed (usually yes)
List< CharacterSceneCharacters
 a list of Characters already present in the scene before runtime. If this list is filled, PlayerPrefabs will be ignored
CheckPoint DebugSpawn
 A checkpoint to use to force the character to spawn at.
CheckpointsAxis CheckpointAttributionAxis = CheckpointsAxis.x
 the axis on which objects should be compared
CheckpointDirections CheckpointAttributionDirection = CheckpointDirections.Ascending
 the direction in which checkpoint order should be determined
CheckPoint CurrentCheckPoint
 the current checkpoint
List< PointOfEntryPointsOfEntry
 a list of all the points of entry for this level
float IntroFadeDuration =1f
 duration of the initial fade in (in seconds)
float OutroFadeDuration =1f
 duration of the fade to black at the end of the level (in seconds)
int FaderID = 0
 the ID to use when triggering the event (should match the ID on the fader you want to use)
MMTweenType FadeTween = new MMTweenType(MMTween.MMTweenCurve.EaseInOutCubic)
 the curve to use for in and out fades
float RespawnDelay = 2f
 duration between a death of the main character and its respawn
bool ResetPointsOnRestart = true
 if this is true, points will be reset when this level restarts - usually after a player's death
BoundsModes BoundsMode = BoundsModes.TwoD
 whether to use a 3D or 2D collider as level bounds, this will be used by Cinemachine confiners
Bounds LevelBounds = new Bounds(Vector3.zero,Vector3.one*10)
 the level limits, camera and player won't go beyond this point.
bool ConvertToColliderBoundsButton
MMLoadScene.LoadingSceneModes LoadingSceneMode = MMLoadScene.LoadingSceneModes.MMSceneLoadingManager
 the method to use to load the destination level
string LoadingSceneName = "LoadingScreen"
 the name of the MMSceneLoadingManager scene you want to use
MMAdditiveSceneLoadingManagerSettings AdditiveLoadingSettings
 the settings to use when loading the scene in additive mode
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

Protected Member Functions

override void Awake ()
 On awake, instantiates the player.
virtual void InstantiatePlayableCharacters ()
 Instantiate playable characters based on the ones specified in the PlayerPrefabs list in the LevelManager's inspector.
virtual void Initialization ()
 Gets current camera, points number, start time, etc.
virtual void CheckpointAssignment ()
 Assigns all respawnable objects in the scene to their checkpoint.
virtual void LevelGUIStart ()
 Initializes GUI stuff.
virtual void SpawnSingleCharacter ()
 Spawns a playable character into the scene.
virtual void RegularSpawnSingleCharacter ()
 Spawns the character at the selected entry point if there's one, or at the selected checkpoint.
virtual void SpawnMultipleCharacters ()
 Spawns multiple playable characters into the scene.
virtual IEnumerator GotoLevelCo (string levelName, bool fadeOut=true)
 Waits for a short time and then loads the specified level.
virtual void LoadScene (string destinationScene)
virtual IEnumerator LoadGameOverSceneCo ()
 A coroutine used to load the game over scene after an optional delay.
virtual void Cleanup ()
 Resets lives, removes persistent characters and stored ones if needed.
virtual IEnumerator SoloModeRestart ()
 Coroutine that kills the player, stops the camera, resets the points.
virtual void UpdateBoundsCollider ()
 Updates the level collider's bounds for Cinemachine (and others that may use it)
virtual void GenerateColliderBounds ()
 A temporary method used to convert level bounds from the old system to actual collider bounds.
virtual void OnEnable ()
 OnDisable, we start listening to events.
virtual void OnDisable ()
 OnDisable, we stop listening to events.
Protected Member Functions inherited from MoreMountains.Tools.MMSingleton< T >
virtual void InitializeSingleton ()
 Initializes the singleton.

Static Protected Member Functions

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

Protected Attributes

DateTime _started
int _savedPoints
string _nextLevel = null
BoxCollider _collider
BoxCollider2D _collider2D
Bounds _originalBounds

Properties

Collider BoundsCollider [get, protected set]
Collider2D BoundsCollider2D [get, protected set]
virtual TimeSpan RunningTime [get]
 the elapsed time since the start of the level
virtual CameraController LevelCameraController [get, set]
virtual List< CharacterPlayers [get, protected set]
virtual List< CheckPointCheckpoints [get, protected set]
Properties inherited from MoreMountains.Tools.MMSingleton< T >
static bool HasInstance [get]
static T Current [get]
static T Instance [get]
 Singleton design pattern.

Additional Inherited Members

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

Detailed Description

Spawns the player, handles checkpoints and respawn.

Member Enumeration Documentation

◆ BoundsModes

◆ CheckpointDirections

Enumerator
Ascending 
Descending 

◆ CheckpointsAxis

the possible checkpoint axis

Enumerator
CheckpointOrder 

Member Function Documentation

◆ Awake()

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

On awake, instantiates the player.

Reimplemented from MoreMountains.Tools.MMSingleton< T >.

◆ CheckpointAssignment()

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

Assigns all respawnable objects in the scene to their checkpoint.

◆ Cleanup()

virtual void MoreMountains.CorgiEngine.LevelManager.Cleanup ( )
protectedvirtual

Resets lives, removes persistent characters and stored ones if needed.

◆ FreezeCharacters()

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

Freezes the character(s)

◆ GenerateColliderBounds()

virtual void MoreMountains.CorgiEngine.LevelManager.GenerateColliderBounds ( )
protectedvirtual

A temporary method used to convert level bounds from the old system to actual collider bounds.

◆ GotoLevel()

virtual void MoreMountains.CorgiEngine.LevelManager.GotoLevel ( string levelName,
bool fadeOut = true,
bool save = true )
virtual

Gets the player to the specified level.

Parameters
levelNameLevel name.

◆ GotoLevelCo()

virtual IEnumerator MoreMountains.CorgiEngine.LevelManager.GotoLevelCo ( string levelName,
bool fadeOut = true )
protectedvirtual

Waits for a short time and then loads the specified level.

Returns
The level co.
Parameters
levelNameLevel name.

◆ GotoNextLevel()

virtual void MoreMountains.CorgiEngine.LevelManager.GotoNextLevel ( )
virtual

Loads the next level, as defined via the SetNextLevel method.

◆ Initialization()

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

Gets current camera, points number, start time, etc.

◆ InitializeStatics()

void MoreMountains.CorgiEngine.LevelManager.InitializeStatics ( )
staticprotected

Statics initialization to support enter play modes.

◆ InstantiatePlayableCharacters()

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

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

◆ LevelGUIStart()

virtual void MoreMountains.CorgiEngine.LevelManager.LevelGUIStart ( )
protectedvirtual

Initializes GUI stuff.

◆ LoadGameOverSceneCo()

virtual IEnumerator MoreMountains.CorgiEngine.LevelManager.LoadGameOverSceneCo ( )
protectedvirtual

A coroutine used to load the game over scene after an optional delay.

Returns

◆ LoadScene()

virtual void MoreMountains.CorgiEngine.LevelManager.LoadScene ( string destinationScene)
protectedvirtual

◆ OnDisable()

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

OnDisable, we stop listening to events.

◆ OnEnable()

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

OnDisable, we start listening to events.

◆ OnMMEvent()

virtual void MoreMountains.CorgiEngine.LevelManager.OnMMEvent ( CorgiEngineEvent engineEvent)
virtual

Catches CorgiEngineEvents and acts on them, playing the corresponding sounds.

Parameters
engineEventCorgiEngineEvent event.

◆ PlayerDead()

virtual void MoreMountains.CorgiEngine.LevelManager.PlayerDead ( Character player)
virtual

Kills the player.

Reimplemented in MoreMountains.CorgiEngine.MultiplayerLevelManager.

◆ RegularSpawnSingleCharacter()

virtual void MoreMountains.CorgiEngine.LevelManager.RegularSpawnSingleCharacter ( )
protectedvirtual

Spawns the character at the selected entry point if there's one, or at the selected checkpoint.

◆ ResetLevelBoundsToOriginalBounds()

virtual void MoreMountains.CorgiEngine.LevelManager.ResetLevelBoundsToOriginalBounds ( )
virtual

Resets the level bounds to their initial value.

◆ SetCurrentCheckpoint()

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

Sets the current checkpoint.

Parameters
newCheckPointNew check point.

◆ SetNewLevelBounds()

virtual void MoreMountains.CorgiEngine.LevelManager.SetNewLevelBounds ( Bounds newBounds)
virtual

Sets the level bounds to the one passed in parameters.

Parameters
newBounds

◆ SetNewMaxLevelBounds()

virtual void MoreMountains.CorgiEngine.LevelManager.SetNewMaxLevelBounds ( Vector3 newMaxBounds)
virtual

Sets the level bound's max point to the one in parameters.

Parameters
newMaxBounds

◆ SetNewMinLevelBounds()

virtual void MoreMountains.CorgiEngine.LevelManager.SetNewMinLevelBounds ( Vector3 newMinBounds)
virtual

Sets the level bound's min point to the one in parameters.

◆ SetNextLevel()

virtual void MoreMountains.CorgiEngine.LevelManager.SetNextLevel ( string levelName)
virtual

Sets the name of the next level this LevelManager will point to.

Parameters
levelName

◆ SoloModeRestart()

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

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

Returns
The player co.

◆ SpawnMultipleCharacters()

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

Spawns multiple playable characters into the scene.

◆ SpawnSingleCharacter()

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

Spawns a playable character into the scene.

◆ Start()

virtual void MoreMountains.CorgiEngine.LevelManager.Start ( )
virtual

Initialization.

◆ ToggleCharacterPause()

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

Toggles Character Pause.

◆ UnFreezeCharacters()

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

Unfreezes the character(s)

◆ UpdateBoundsCollider()

virtual void MoreMountains.CorgiEngine.LevelManager.UpdateBoundsCollider ( )
protectedvirtual

Updates the level collider's bounds for Cinemachine (and others that may use it)

Member Data Documentation

◆ _collider

BoxCollider MoreMountains.CorgiEngine.LevelManager._collider
protected

◆ _collider2D

BoxCollider2D MoreMountains.CorgiEngine.LevelManager._collider2D
protected

◆ _nextLevel

string MoreMountains.CorgiEngine.LevelManager._nextLevel = null
protected

◆ _originalBounds

Bounds MoreMountains.CorgiEngine.LevelManager._originalBounds
protected

◆ _savedPoints

int MoreMountains.CorgiEngine.LevelManager._savedPoints
protected

◆ _started

DateTime MoreMountains.CorgiEngine.LevelManager._started
protected

◆ AdditiveLoadingSettings

MMAdditiveSceneLoadingManagerSettings MoreMountains.CorgiEngine.LevelManager.AdditiveLoadingSettings

the settings to use when loading the scene in additive mode

◆ AutoAttributePlayerIDs

bool MoreMountains.CorgiEngine.LevelManager.AutoAttributePlayerIDs = true

should the player IDs be auto attributed (usually yes)

◆ BoundsMode

BoundsModes MoreMountains.CorgiEngine.LevelManager.BoundsMode = BoundsModes.TwoD

whether to use a 3D or 2D collider as level bounds, this will be used by Cinemachine confiners

◆ CheckpointAttributionAxis

CheckpointsAxis MoreMountains.CorgiEngine.LevelManager.CheckpointAttributionAxis = CheckpointsAxis.x

the axis on which objects should be compared

◆ CheckpointAttributionDirection

CheckpointDirections MoreMountains.CorgiEngine.LevelManager.CheckpointAttributionDirection = CheckpointDirections.Ascending

the direction in which checkpoint order should be determined

◆ ConvertToColliderBoundsButton

bool MoreMountains.CorgiEngine.LevelManager.ConvertToColliderBoundsButton

◆ CurrentCheckPoint

CheckPoint MoreMountains.CorgiEngine.LevelManager.CurrentCheckPoint

the current checkpoint

◆ DebugSpawn

CheckPoint MoreMountains.CorgiEngine.LevelManager.DebugSpawn

A checkpoint to use to force the character to spawn at.

◆ FaderID

int MoreMountains.CorgiEngine.LevelManager.FaderID = 0

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

◆ FadeTween

MMTweenType MoreMountains.CorgiEngine.LevelManager.FadeTween = new MMTweenType(MMTween.MMTweenCurve.EaseInOutCubic)

the curve to use for in and out fades

◆ IntroFadeDuration

float MoreMountains.CorgiEngine.LevelManager.IntroFadeDuration =1f

duration of the initial fade in (in seconds)

◆ LevelBounds

Bounds MoreMountains.CorgiEngine.LevelManager.LevelBounds = new Bounds(Vector3.zero,Vector3.one*10)

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

◆ LoadingSceneMode

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

the method to use to load the destination level

◆ LoadingSceneName

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

the name of the MMSceneLoadingManager scene you want to use

◆ OutroFadeDuration

float MoreMountains.CorgiEngine.LevelManager.OutroFadeDuration =1f

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

◆ PlayerPrefabs

Character [] MoreMountains.CorgiEngine.LevelManager.PlayerPrefabs

the prefab you want for your player

the list of player prefabs to instantiate

◆ PointsOfEntry

List<PointOfEntry> MoreMountains.CorgiEngine.LevelManager.PointsOfEntry

a list of all the points of entry for this level

◆ ResetPointsOnRestart

bool MoreMountains.CorgiEngine.LevelManager.ResetPointsOnRestart = true

if this is true, points will be reset when this level restarts - usually after a player's death

◆ RespawnDelay

float MoreMountains.CorgiEngine.LevelManager.RespawnDelay = 2f

duration between a death of the main character and its respawn

◆ SceneCharacters

List<Character> MoreMountains.CorgiEngine.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.CorgiEngine.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

Property Documentation

◆ BoundsCollider

Collider MoreMountains.CorgiEngine.LevelManager.BoundsCollider
getprotected set

◆ BoundsCollider2D

Collider2D MoreMountains.CorgiEngine.LevelManager.BoundsCollider2D
getprotected set

◆ Checkpoints

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

◆ LevelCameraController

virtual CameraController MoreMountains.CorgiEngine.LevelManager.LevelCameraController
getset

◆ Players

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

◆ RunningTime

virtual TimeSpan MoreMountains.CorgiEngine.LevelManager.RunningTime
get

the elapsed time since the start of the level


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