Corgi Engine  v8.8
MoreMountains.CorgiEngine.Room Class Reference

This class lets you define the boundaries of rooms in your level. Rooms are useful if you want to cut your level into portions (think Super Metroid or Hollow Knight for example). These rooms will require their own virtual camera, and a confiner to define their size. Note that the confiner is different from the collider that defines the room. You can see an example of rooms in action in the RetroVania demo scene. More...

Inheritance diagram for MoreMountains.CorgiEngine.Room:
MoreMountains.CorgiEngine.CorgiMonoBehaviour MoreMountains.Tools.MMEventListener< CorgiEngineEvent >

Public Member Functions

virtual void PlayerEntersRoom ()
 Call this to let the room know a player entered More...
 
virtual void PlayerExitsRoom ()
 Call this to let this room know a player exited More...
 
virtual void OnMMEvent (CorgiEngineEvent corgiEngineEvent)
 When we get a respawn event, we ask for a camera reposition More...
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< CorgiEngineEvent >
void OnMMEvent (T eventType)
 

Public Attributes

CinemachineVirtualCamera VirtualCamera
 the virtual camera associated to this room More...
 
Collider2D Confiner
 the confiner for this room, that will constrain the virtual camera, usually placed on a child object of the Room More...
 
CinemachineConfiner CinemachineCameraConfiner
 the confiner component of the virtual camera More...
 
bool ResizeConfinerAutomatically = true
 whether or not the confiner should be auto resized on start to match the camera's size and ratio More...
 
bool AutoDetectFirstRoomOnStart = true
 whether or not this Room should look at the level's start position and declare itself the current room on start or not More...
 
bool CurrentRoom = false
 whether this room is the current room or not More...
 
bool RoomVisited = false
 whether this room has already been visited or not More...
 
UnityEvent OnPlayerEntersRoomForTheFirstTime
 the event to trigger when the player enters the room for the first time More...
 
UnityEvent OnPlayerEntersRoom
 the event to trigger everytime the player enters the room More...
 
UnityEvent OnPlayerExitsRoom
 the event to trigger everytime the player exits the room More...
 
List< GameObject > ActivationList
 a list of gameobjects to enable when entering the room, and disable when exiting it More...
 

Protected Member Functions

virtual void Start ()
 On Start we initialize our room More...
 
virtual void Initialization ()
 Grabs our Room collider, our main camera, and starts the confiner resize More...
 
virtual IEnumerator ResizeConfiner ()
 Resizes the confiner More...
 
virtual void HandleLevelStartDetection ()
 Looks for the level start position and if it's inside the room, makes this room the current one More...
 
virtual void OnEnable ()
 On enable we start listening for events More...
 
virtual void OnDisable ()
 On enable we stop listening for events More...
 

Protected Attributes

Collider2D _roomCollider2D
 
Camera _mainCamera
 
Vector2 _cameraSize
 
bool _initialized = false
 

Properties

virtual Collider2D RoomCollider [get]
 the collider for this room More...
 

Detailed Description

This class lets you define the boundaries of rooms in your level. Rooms are useful if you want to cut your level into portions (think Super Metroid or Hollow Knight for example). These rooms will require their own virtual camera, and a confiner to define their size. Note that the confiner is different from the collider that defines the room. You can see an example of rooms in action in the RetroVania demo scene.

Member Function Documentation

◆ HandleLevelStartDetection()

virtual void MoreMountains.CorgiEngine.Room.HandleLevelStartDetection ( )
protectedvirtual

Looks for the level start position and if it's inside the room, makes this room the current one

◆ Initialization()

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

Grabs our Room collider, our main camera, and starts the confiner resize

◆ OnDisable()

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

On enable we stop listening for events

◆ OnEnable()

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

On enable we start listening for events

◆ OnMMEvent()

virtual void MoreMountains.CorgiEngine.Room.OnMMEvent ( CorgiEngineEvent  corgiEngineEvent)
virtual

When we get a respawn event, we ask for a camera reposition

Parameters
corgiEngineEvent

◆ PlayerEntersRoom()

virtual void MoreMountains.CorgiEngine.Room.PlayerEntersRoom ( )
virtual

Call this to let the room know a player entered

◆ PlayerExitsRoom()

virtual void MoreMountains.CorgiEngine.Room.PlayerExitsRoom ( )
virtual

Call this to let this room know a player exited

◆ ResizeConfiner()

virtual IEnumerator MoreMountains.CorgiEngine.Room.ResizeConfiner ( )
protectedvirtual

Resizes the confiner

Returns

◆ Start()

virtual void MoreMountains.CorgiEngine.Room.Start ( )
protectedvirtual

On Start we initialize our room

Member Data Documentation

◆ _cameraSize

Vector2 MoreMountains.CorgiEngine.Room._cameraSize
protected

◆ _initialized

bool MoreMountains.CorgiEngine.Room._initialized = false
protected

◆ _mainCamera

Camera MoreMountains.CorgiEngine.Room._mainCamera
protected

◆ _roomCollider2D

Collider2D MoreMountains.CorgiEngine.Room._roomCollider2D
protected

◆ ActivationList

List<GameObject> MoreMountains.CorgiEngine.Room.ActivationList

a list of gameobjects to enable when entering the room, and disable when exiting it

◆ AutoDetectFirstRoomOnStart

bool MoreMountains.CorgiEngine.Room.AutoDetectFirstRoomOnStart = true

whether or not this Room should look at the level's start position and declare itself the current room on start or not

◆ CinemachineCameraConfiner

CinemachineConfiner MoreMountains.CorgiEngine.Room.CinemachineCameraConfiner

the confiner component of the virtual camera

◆ Confiner

Collider2D MoreMountains.CorgiEngine.Room.Confiner

the confiner for this room, that will constrain the virtual camera, usually placed on a child object of the Room

◆ CurrentRoom

bool MoreMountains.CorgiEngine.Room.CurrentRoom = false

whether this room is the current room or not

◆ OnPlayerEntersRoom

UnityEvent MoreMountains.CorgiEngine.Room.OnPlayerEntersRoom

the event to trigger everytime the player enters the room

◆ OnPlayerEntersRoomForTheFirstTime

UnityEvent MoreMountains.CorgiEngine.Room.OnPlayerEntersRoomForTheFirstTime

the event to trigger when the player enters the room for the first time

◆ OnPlayerExitsRoom

UnityEvent MoreMountains.CorgiEngine.Room.OnPlayerExitsRoom

the event to trigger everytime the player exits the room

◆ ResizeConfinerAutomatically

bool MoreMountains.CorgiEngine.Room.ResizeConfinerAutomatically = true

whether or not the confiner should be auto resized on start to match the camera's size and ratio

◆ RoomVisited

bool MoreMountains.CorgiEngine.Room.RoomVisited = false

whether this room has already been visited or not

◆ VirtualCamera

CinemachineVirtualCamera MoreMountains.CorgiEngine.Room.VirtualCamera

the virtual camera associated to this room

Property Documentation

◆ RoomCollider

virtual Collider2D MoreMountains.CorgiEngine.Room.RoomCollider
get

the collider for this room


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