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

Detailed Description

This script has functions for opening and closing the door object that this script is attached to. The door can be locked. The reason why a number is used for the doorLocked variable instead of a Boolean is, for example, if two separate events need to contribute toward unlocking the door, the door lock value can be incremented by 1/2 of the total, so the door won't get unlocked until both events happen.

Documentation updated 3/23/2025

Author
Alexander Art
Todo
(Maybe) Stop the player from being able to close the door on themself or other entities.

Public Member Functions

void OpenDoor ()
 Open the door, unless locked.
 
void ForceOpenDoor ()
 Open the door, even if locked.
 
void CloseDoor ()
 Close the door, unless locked.
 
void ForceCloseDoor ()
 Close the door, even if locked.
 
void ToggleDoor ()
 Method for opening/closing the door: closes the door if open, opens the door if closed, unless locked.
 
void ForceToggleDoor ()
 Alternative method for opening/closing the door: closes the door if open, opens the door if closed, even if locked.
 
void SetLock (float value)
 Use this function to set the value of the lock. Anything greater than 0, and the door is locked.
 
void ChangeLock (float value)
 Use this function to increment the value of the lock.
 
bool GetLocked ()
 Returns true if the door is locked, otherwise false.
 
bool GetOpen ()
 Returns the current open state of the door.
 

Protected Attributes

Sprite closedSprite
 Reference to the image of the closed door.
 
Sprite openSprite
 Reference to the image of the open door.
 
GameObject doorCollider
 Reference to door's collision that goes away when the door is open.
 
bool openByDefault = false
 Whether the door should be open or closed when the scene is loaded.
 
float doorLocked = 0f
 If this number is greater than 0, then the door is locked.
 

Private Member Functions

void Start ()
 

Private Attributes

bool doorOpen = false
 The current state of the door.
 

Member Function Documentation

◆ ChangeLock()

void DoorObject.ChangeLock ( float value)

Use this function to increment the value of the lock.

◆ CloseDoor()

void DoorObject.CloseDoor ( )

Close the door, unless locked.

◆ ForceCloseDoor()

void DoorObject.ForceCloseDoor ( )

Close the door, even if locked.

◆ ForceOpenDoor()

void DoorObject.ForceOpenDoor ( )

Open the door, even if locked.

◆ ForceToggleDoor()

void DoorObject.ForceToggleDoor ( )

Alternative method for opening/closing the door: closes the door if open, opens the door if closed, even if locked.

◆ GetLocked()

bool DoorObject.GetLocked ( )

Returns true if the door is locked, otherwise false.

◆ GetOpen()

bool DoorObject.GetOpen ( )

Returns the current open state of the door.

◆ OpenDoor()

void DoorObject.OpenDoor ( )

Open the door, unless locked.

◆ SetLock()

void DoorObject.SetLock ( float value)

Use this function to set the value of the lock. Anything greater than 0, and the door is locked.

◆ Start()

void DoorObject.Start ( )
private

◆ ToggleDoor()

void DoorObject.ToggleDoor ( )

Method for opening/closing the door: closes the door if open, opens the door if closed, unless locked.

Member Data Documentation

◆ closedSprite

Sprite DoorObject.closedSprite
protected

Reference to the image of the closed door.

◆ doorCollider

GameObject DoorObject.doorCollider
protected

Reference to door's collision that goes away when the door is open.

◆ doorLocked

float DoorObject.doorLocked = 0f
protected

If this number is greater than 0, then the door is locked.

◆ doorOpen

bool DoorObject.doorOpen = false
private

The current state of the door.

◆ openByDefault

bool DoorObject.openByDefault = false
protected

Whether the door should be open or closed when the scene is loaded.

◆ openSprite

Sprite DoorObject.openSprite
protected

Reference to the image of the open door.


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