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

Detailed Description

This script is a work in progress. It will control most of Geb's bossroom (trigger zone, doors, cutscenes, healthbar visibility). This script mainly consists of:

  • 6 functions that get called only once when Geb enters a new phase, one for each phase (except for the first one).
  • 7 functions that get called every frame depending on Geb's phase, one for each phase.

Documentation updated 5/3/2025

Author
Alexander Art
Todo

Freeze the player during the cutscenes.

Make the distribution of the falling rocks less RNG-based.

Keep track of the camera's default offset and return the camera to the default offset when Geb is defeated.

Public Member Functions

void GebOpeningCutsceneStarted ()
 Called by GebPhaseController once when the opening cutscene starts.
 
void GebPhase1Started ()
 Called by GebPhaseController once when the opening cutscene is over and the bossfight starts.
 
void GebPhase2Started ()
 Called by GebPhaseController once when phase 2 starts.
 
void GebPhase3Started ()
 Called by GebPhaseController once when phase 3 starts.
 
void GebClosingCutsceneStarted ()
 Called by GebPhaseController once when the closing cutscene starts.
 
void GebDefeated ()
 Called by GebPhaseController once when the closing cutscene finishes.
 
void DecrementRockGolemCount ()
 Called by the rock golems when they die. Subtracts 1 from the rock golem count.
 
void GebInteracted ()
 Runs when the player interacts with the Geb interactable.
 
void GebWarpObelisk ()
 Needed for Geb's obelisk to interact with the DataManager without it getting unassigned randomly.
 

Public Attributes

PatrolZone bounds
 Reference to Geb's PatrolZone (Bounds), the left end and right end of Geb's bossroom that the rock golems will move around in.
 
int rockGolemCount = 0
 Number of rock golems currently in the room.
 
int maxRockGolems = 4
 Maximum number of rock golems that can be present in the room before they stop getting spawned.
 

Protected Attributes

CinemachineVirtualCamera virtualCamera
 Reference to the Virtual Camera. Needed for camera control during the cutscenes.
 
CinemachineFramingTransposer framingTransposer
 Reference to the Virtual Camera's transposer. Needed for extra camera control.
 
BossHealthbarHUD healthbar
 Reference to the boss healthbar HUD, used for making it appear and disappear at the start and end of the fight.
 
Animator animator
 Reference to Geb's animator (used for animating the rock throw in the cutscene).
 
GebPhaseController phaseController
 Reference to Geb's phase controller.
 
GebBossController bossController
 Reference to Geb's boss controller.
 
GameObject player
 Reference to the player object.
 
GameObject cutsceneRock
 Reference to the rock (prefab) that Geb throws during the opening cutscene.
 
GameObject doorBlocker
 Reference to the part of the door in the scene that Geb closes off in the opening cutscene.
 
GameObject fallingSkyRocks
 Reference to the rocks (prefab) that fall from the sky during Geb's earthquake attack in phase 3.
 
GameObject defeatedMessage
 Reference to the defeat message that appears after Geb is defeated.
 
GameObject interactableZone
 Reference to the interactable zone for when the player needs to press E after Geb is defeated.
 
GameObject warpObelisk
 Reference to the warp obelisk that appears after Geb is defeated.
 
GameObject shatteredGeb
 Reference to the shattered version of Geb that is instantiated after Geb is defeated.
 

Private Member Functions

void Awake ()
 Set references.
 
void Start ()
 Access the current zoom to set defaultZoom variable. Also calculate the minimum and maximum x position for the player.
 
void Update ()
 Every frame, activate the logic for the current phase Geb is in. Regardless of phase, keep the player within the bounds of the bossroom.
 
void InactiveState ()
 Runs every frame when Geb is inactive.
 
void OpeningCutsceneState ()
 Runs every frame when the opening cutscene is playing.
 
void Phase1State ()
 Runs every frame when Geb is in phase 1.
 
void Phase2State ()
 Runs every frame when Geb is in phase 2.
 
void Phase3State ()
 Runs every frame when Geb is in phase 3.
 
void ClosingCutsceneState ()
 Runs every frame when Geb is defeated and the closing cutscene is playing.
 
void DefeatedState ()
 Runs every frame when the closing cutscene is over.
 

Private Attributes

EventReference bossMusic
 Reference to Geb's boss music.
 
EventReference sceneMusic
 Reference to the desert scene music.
 
DataManager dataManager
 Reference to the DataManager.
 
float fightZoom = 12f
 How far to zoom out the camera for Geb's bossfight.
 
float fallingRockSpawnPeriod = 0.075f
 How often a rock will fall from the sky during Geb's earthquake attack.
 
System.Random rng = new System.Random()
 Create random number generator.
 
float defaultZoom
 The zoom of the camera before the bossfight starts.
 
float fallingRockSpawnTimer = 0.0f
 Used for keeping track of when the last rock fell from the sky.
 
float minPlayerPosX
 The minimum x position that the player can have. Calculated using the player's width and the bounds of the room.
 
float maxPlayerPosX
 The maximum x position that the player can have. Calculated using the player's width and the bounds of the room.
 
GameObject summonedRock
 Reference to the rock that is spawned during the opening cutscene.
 
bool rockAnimated = false
 Used for making sure that Geb's rock throw animation is only triggered once during the opening cutscene.
 
bool rockSummoned = false
 Used for making sure only one rock is spawned during the opening cutscene.
 

Member Function Documentation

◆ Awake()

void GebRoomController.Awake ( )
private

Set references.

◆ ClosingCutsceneState()

void GebRoomController.ClosingCutsceneState ( )
private

Runs every frame when Geb is defeated and the closing cutscene is playing.

◆ DecrementRockGolemCount()

void GebRoomController.DecrementRockGolemCount ( )

Called by the rock golems when they die. Subtracts 1 from the rock golem count.

◆ DefeatedState()

void GebRoomController.DefeatedState ( )
private

Runs every frame when the closing cutscene is over.

◆ GebClosingCutsceneStarted()

void GebRoomController.GebClosingCutsceneStarted ( )

Called by GebPhaseController once when the closing cutscene starts.

◆ GebDefeated()

void GebRoomController.GebDefeated ( )

Called by GebPhaseController once when the closing cutscene finishes.

Move the defeated message to Geb.

Make the defeated message visible.

Move the interactable to Geb.

Move the warp obelisk to Geb (y = -50.03f to bring to the ground).

◆ GebInteracted()

void GebRoomController.GebInteracted ( )

Runs when the player interacts with the Geb interactable.

◆ GebOpeningCutsceneStarted()

void GebRoomController.GebOpeningCutsceneStarted ( )

Called by GebPhaseController once when the opening cutscene starts.

◆ GebPhase1Started()

void GebRoomController.GebPhase1Started ( )

Called by GebPhaseController once when the opening cutscene is over and the bossfight starts.

◆ GebPhase2Started()

void GebRoomController.GebPhase2Started ( )

Called by GebPhaseController once when phase 2 starts.

◆ GebPhase3Started()

void GebRoomController.GebPhase3Started ( )

Called by GebPhaseController once when phase 3 starts.

◆ GebWarpObelisk()

void GebRoomController.GebWarpObelisk ( )

Needed for Geb's obelisk to interact with the DataManager without it getting unassigned randomly.

◆ InactiveState()

void GebRoomController.InactiveState ( )
private

Runs every frame when Geb is inactive.

◆ OpeningCutsceneState()

void GebRoomController.OpeningCutsceneState ( )
private

Runs every frame when the opening cutscene is playing.

◆ Phase1State()

void GebRoomController.Phase1State ( )
private

Runs every frame when Geb is in phase 1.

◆ Phase2State()

void GebRoomController.Phase2State ( )
private

Runs every frame when Geb is in phase 2.

◆ Phase3State()

void GebRoomController.Phase3State ( )
private

Runs every frame when Geb is in phase 3.

◆ Start()

void GebRoomController.Start ( )
private

Access the current zoom to set defaultZoom variable. Also calculate the minimum and maximum x position for the player.

◆ Update()

void GebRoomController.Update ( )
private

Every frame, activate the logic for the current phase Geb is in. Regardless of phase, keep the player within the bounds of the bossroom.

Member Data Documentation

◆ animator

Animator GebRoomController.animator
protected

Reference to Geb's animator (used for animating the rock throw in the cutscene).

◆ bossController

GebBossController GebRoomController.bossController
protected

Reference to Geb's boss controller.

◆ bossMusic

EventReference GebRoomController.bossMusic
private

Reference to Geb's boss music.

◆ bounds

PatrolZone GebRoomController.bounds

Reference to Geb's PatrolZone (Bounds), the left end and right end of Geb's bossroom that the rock golems will move around in.

◆ cutsceneRock

GameObject GebRoomController.cutsceneRock
protected

Reference to the rock (prefab) that Geb throws during the opening cutscene.

◆ dataManager

DataManager GebRoomController.dataManager
private

Reference to the DataManager.

◆ defaultZoom

float GebRoomController.defaultZoom
private

The zoom of the camera before the bossfight starts.

◆ defeatedMessage

GameObject GebRoomController.defeatedMessage
protected

Reference to the defeat message that appears after Geb is defeated.

◆ doorBlocker

GameObject GebRoomController.doorBlocker
protected

Reference to the part of the door in the scene that Geb closes off in the opening cutscene.

◆ fallingRockSpawnPeriod

float GebRoomController.fallingRockSpawnPeriod = 0.075f
private

How often a rock will fall from the sky during Geb's earthquake attack.

◆ fallingRockSpawnTimer

float GebRoomController.fallingRockSpawnTimer = 0.0f
private

Used for keeping track of when the last rock fell from the sky.

◆ fallingSkyRocks

GameObject GebRoomController.fallingSkyRocks
protected

Reference to the rocks (prefab) that fall from the sky during Geb's earthquake attack in phase 3.

◆ fightZoom

float GebRoomController.fightZoom = 12f
private

How far to zoom out the camera for Geb's bossfight.

◆ framingTransposer

CinemachineFramingTransposer GebRoomController.framingTransposer
protected

Reference to the Virtual Camera's transposer. Needed for extra camera control.

◆ healthbar

BossHealthbarHUD GebRoomController.healthbar
protected

Reference to the boss healthbar HUD, used for making it appear and disappear at the start and end of the fight.

◆ interactableZone

GameObject GebRoomController.interactableZone
protected

Reference to the interactable zone for when the player needs to press E after Geb is defeated.

◆ maxPlayerPosX

float GebRoomController.maxPlayerPosX
private

The maximum x position that the player can have. Calculated using the player's width and the bounds of the room.

◆ maxRockGolems

int GebRoomController.maxRockGolems = 4

Maximum number of rock golems that can be present in the room before they stop getting spawned.

◆ minPlayerPosX

float GebRoomController.minPlayerPosX
private

The minimum x position that the player can have. Calculated using the player's width and the bounds of the room.

◆ phaseController

GebPhaseController GebRoomController.phaseController
protected

Reference to Geb's phase controller.

◆ player

GameObject GebRoomController.player
protected

Reference to the player object.

◆ rng

System.Random GebRoomController.rng = new System.Random()
private

Create random number generator.

◆ rockAnimated

bool GebRoomController.rockAnimated = false
private

Used for making sure that Geb's rock throw animation is only triggered once during the opening cutscene.

◆ rockGolemCount

int GebRoomController.rockGolemCount = 0

Number of rock golems currently in the room.

◆ rockSummoned

bool GebRoomController.rockSummoned = false
private

Used for making sure only one rock is spawned during the opening cutscene.

◆ sceneMusic

EventReference GebRoomController.sceneMusic
private

Reference to the desert scene music.

◆ shatteredGeb

GameObject GebRoomController.shatteredGeb
protected

Reference to the shattered version of Geb that is instantiated after Geb is defeated.

◆ summonedRock

GameObject GebRoomController.summonedRock
private

Reference to the rock that is spawned during the opening cutscene.

◆ virtualCamera

CinemachineVirtualCamera GebRoomController.virtualCamera
protected

Reference to the Virtual Camera. Needed for camera control during the cutscenes.

◆ warpObelisk

GameObject GebRoomController.warpObelisk
protected

Reference to the warp obelisk that appears after Geb is defeated.


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