TopDown Engine  v3.6
MoreMountains.TopDownEngine.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 KoalaRooms demo scene. More...

Inheritance diagram for MoreMountains.TopDownEngine.Room:
MoreMountains.TopDownEngine.TopDownMonoBehaviour MoreMountains.Tools.MMEventListener< TopDownEngineEvent > MoreMountains.Tools.MMMonoBehaviour

Public Types

enum  Modes { Modes.TwoD, Modes.ThreeD }
 

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 (TopDownEngineEvent topDownEngineEvent)
 When we get a respawn event, we ask for a camera reposition More...
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< TopDownEngineEvent >
void OnMMEvent (T eventType)
 

Public Attributes

Modes Mode = Modes.TwoD
 whether this room is intended to work in 2D or 3D mode 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...
 
float RoomDepth = 100f
 the depth of the room (used to resize the z value of the confiner 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 Awake ()
 On Awake we reset our camera's priority More...
 
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

Collider _roomCollider
 
Collider2D _roomCollider2D
 
Camera _mainCamera
 
Vector2 _cameraSize
 
bool _initialized = false
 

Properties

Vector3 RoomColliderCenter [get]
 the collider for this room More...
 
Vector3 RoomColliderSize [get]
 
Bounds RoomBounds [get]
 

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 KoalaRooms demo scene.

Member Enumeration Documentation

◆ Modes

Enumerator
TwoD 
ThreeD 

Member Function Documentation

◆ Awake()

virtual void MoreMountains.TopDownEngine.Room.Awake ( )
protectedvirtual

On Awake we reset our camera's priority

◆ HandleLevelStartDetection()

virtual void MoreMountains.TopDownEngine.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.TopDownEngine.Room.Initialization ( )
protectedvirtual

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

◆ OnDisable()

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

On enable we stop listening for events

◆ OnEnable()

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

On enable we start listening for events

◆ OnMMEvent()

virtual void MoreMountains.TopDownEngine.Room.OnMMEvent ( TopDownEngineEvent  topDownEngineEvent)
virtual

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

Parameters
topDownEngineEvent

◆ PlayerEntersRoom()

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

Call this to let the room know a player entered

◆ PlayerExitsRoom()

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

Call this to let this room know a player exited

◆ ResizeConfiner()

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

Resizes the confiner

Returns

◆ Start()

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

On Start we initialize our room

Member Data Documentation

◆ _cameraSize

Vector2 MoreMountains.TopDownEngine.Room._cameraSize
protected

◆ _initialized

bool MoreMountains.TopDownEngine.Room._initialized = false
protected

◆ _mainCamera

Camera MoreMountains.TopDownEngine.Room._mainCamera
protected

◆ _roomCollider

Collider MoreMountains.TopDownEngine.Room._roomCollider
protected

◆ _roomCollider2D

Collider2D MoreMountains.TopDownEngine.Room._roomCollider2D
protected

◆ ActivationList

List<GameObject> MoreMountains.TopDownEngine.Room.ActivationList

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

◆ AutoDetectFirstRoomOnStart

bool MoreMountains.TopDownEngine.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

◆ CurrentRoom

bool MoreMountains.TopDownEngine.Room.CurrentRoom = false

whether this room is the current room or not

◆ Mode

Modes MoreMountains.TopDownEngine.Room.Mode = Modes.TwoD

whether this room is intended to work in 2D or 3D mode

◆ OnPlayerEntersRoom

UnityEvent MoreMountains.TopDownEngine.Room.OnPlayerEntersRoom

the event to trigger everytime the player enters the room

◆ OnPlayerEntersRoomForTheFirstTime

UnityEvent MoreMountains.TopDownEngine.Room.OnPlayerEntersRoomForTheFirstTime

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

◆ OnPlayerExitsRoom

UnityEvent MoreMountains.TopDownEngine.Room.OnPlayerExitsRoom

the event to trigger everytime the player exits the room

◆ ResizeConfinerAutomatically

bool MoreMountains.TopDownEngine.Room.ResizeConfinerAutomatically = true

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

◆ RoomDepth

float MoreMountains.TopDownEngine.Room.RoomDepth = 100f

the depth of the room (used to resize the z value of the confiner

◆ RoomVisited

bool MoreMountains.TopDownEngine.Room.RoomVisited = false

whether this room has already been visited or not

Property Documentation

◆ RoomBounds

Bounds MoreMountains.TopDownEngine.Room.RoomBounds
get

◆ RoomColliderCenter

Vector3 MoreMountains.TopDownEngine.Room.RoomColliderCenter
get

the collider for this room

◆ RoomColliderSize

Vector3 MoreMountains.TopDownEngine.Room.RoomColliderSize
get

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