Eye of the Nile Docs
Everything you need to know to get started!
Loading...
Searching...
No Matches
ExitZone Class Reference

Detailed Description

If the player is inside a warp zone (such as a door or some form of exit), this script will warp them to the corresponding exit door. In other words, if you go through a door, this script spawns the player on the other side.

Documentation updated 11/10/2024

Author
Roy Pascual

Public Attributes

UnityEvent< string > collidedEvent
 Unity event triggered when a player begins to warp.
 
StageWarp stageWarp
 Reference to the StageWarp component, which contains basic information about the warp.
 

Private Member Functions

void WarpToZone ()
 Updates WarpInfo and invokes collidedEvent, which hopefully LoadNewStage() in StageLoader is subscribed to (thus loading the destination).
 
void OnTriggerStay2D (Collider2D collider)
 
void OnTriggerExit2D (Collider2D collider)
 Runs when an object leaves the warp zone. If that object is the player, tell the player it's not standing on a warp anymore.
 
void Awake ()
 Set reference to the StageWarp component.
 

Private Attributes

string _collisionLayer = "Player"
 Layers which object collisions will be searched for. Set to "Player.".
 

Member Function Documentation

◆ Awake()

void ExitZone.Awake ( )
private

Set reference to the StageWarp component.

◆ OnTriggerExit2D()

void ExitZone.OnTriggerExit2D ( Collider2D collider)
private

Runs when an object leaves the warp zone. If that object is the player, tell the player it's not standing on a warp anymore.

◆ OnTriggerStay2D()

void ExitZone.OnTriggerStay2D ( Collider2D collider)
private

Runs when an object is inside the warp zone. If that object is the player, warp the player (unless the warp is classified as a door rather than an exit, in which case wait for the player to press W while inside the warp zone).

◆ WarpToZone()

void ExitZone.WarpToZone ( )
private

Updates WarpInfo and invokes collidedEvent, which hopefully LoadNewStage() in StageLoader is subscribed to (thus loading the destination).

Member Data Documentation

◆ _collisionLayer

string ExitZone._collisionLayer = "Player"
private

Layers which object collisions will be searched for. Set to "Player.".

Note
Should only contain the player. This is a way of singling out the player from any other object that might enter the warp.

◆ collidedEvent

UnityEvent<string> ExitZone.collidedEvent

Unity event triggered when a player begins to warp.

Note
LoadNewStage() in StageLoader needs to be subscribed to this. This will tell StageLoader to load the warp's destination and spawn the player there (as well as the face to black transition).

◆ stageWarp

StageWarp ExitZone.stageWarp

Reference to the StageWarp component, which contains basic information about the warp.


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