-
Notifications
You must be signed in to change notification settings - Fork 2
Day Night Cycle
Calvin John edited this page Sep 12, 2024
·
16 revisions
The DayNightService class manages the day/night cycle in the game. It uses GameTime to track the time on a predefined variable (5 minutes) and handles the transition from day and night by triggering events, which other components respond to.
The main functionality of this feature is to;
- Track time to the interval of 5 minutes which then triggers the end of day cycle.
- Once the end of day condition is met, the game time is paused and certain events are triggered to ultimately dispose game components, transition to the enddaydisplay then moraldecisiondisplay and finally back to the maingamescreen as a newday
- Event Handling by triggering events, allowing for other components such as displays to listen and repsond.
-
logger (Logger)
: Used to log events and activities -
FIVE_MINUTES (long)
: Constant representing 5 minutes -
lastCheckTime(long)
: Stores last time check interval -
gameTime (GameTime)
: checks and manipulates the time in game -
endOfDayTriggered (boolean)
: flag which defines whether the end of day sequence has been triggered. -
enddayEventHandler (EventHandler)
: Manages events and listens to events within this cycle.
-
create()
: Sets up event listeners for handling the new day. Listens for "decisionDone" event. -
update()
: Constantly checks the game time and compares the last interval to the variable containing 5 minutes of elapsed time, triggering the end of day cycle. -
startNewDay()
: Starts the new day. Resumes game time and clears endOfDayTriggered flag. -
getEvents()
: Access to the event handler to listen and trigger events.
- Dispose: Triggered during end of day sequence to inform MainGameOrderTicketDisplay to reset.
- endOfDay: Indicates end of day, related to updating necessary affected displays and transitioning to enddaydisplay then moraldecisiondisplay.
-
decisionDone: Used in the
startNewDay()
method to trigger the start of a new day. - newday: Start of a new day, facilitating components to update necessary actions such as updating the current day display.
- callpastsecond: used in update as a trigger for every second in the game, to update and matc for the displayed timer
![Screen Shot 2024-09-12 at 12 39 12 pm](https://github.com/user-attachments/assets/af4627ee-13bb-4573-a495-1936fa2c9772)
Inventory System
Scoring System
Food Recipes
Level System
Player Actions
Ordering System
Stations
Items
Map Design
Customers
Pause Menu
Upgrades
End of Day Display
Day Night Cycle
Moral System
Debug Terminal
Game Interactions Tutorial
Backstory Cutscenes
Entities and Components
Input Handling
Game Screens and Areas
Fire Extinguisher Handler Component
MainGameActions Create Docket Triggers
Main Game Order Button Display
BackstoryCutsceneDisplay Test Plan
Test Plan for MainGameOrderTicketDisplay
Test Plan for MainGameOrderBtnDisplay
Test Plan for DocketLineDisplay
Test plan for RandomComboService
Test plan for SpeedBoostUpgrade
Test plan for DancePartyUpgrade