-
Notifications
You must be signed in to change notification settings - Fork 7
Time System
The time system serves as an integral part of Gardens of the Galaxy, providing dynamic updates and information to other dependent classes. Since this is a farming game, the core goals revolve around time as you build and expand your farm over time while growing plants that take time to harvest. Hence, it is essential that an intuitive yet easy-to-understand implementation of the time system is required so that other classes can interact easily with the time system and that valuable information is provided to these dependent classes.
This implementation of the time system provides working in-game time, where each day in the game lasts 12 minutes in real time. A visual implementation of the in-game time is also present at the top left of the screen, which has an indicator (sun or moon) as well as the current hour of the day (in 12-hour time). The time will dynamically update on the UI, and the indicator will update to match that time as well. For example, as the day turns into night, the sun will slowly set and the moon will eventually rise. This ensures that the player will always be informed of the current time through text and images, providing a much more visually appealing experience for the player. The implementation also provides a pause and unpause function as well as a function to set the time to aid in debugging and testing to improve workflow.
The time display is set to appear in the top left corner, and stay fixed there for the duration of the game. It combines a clock frame, a clock image
The implementation is centred in GameTime
, GameTimeDisplay
and TimeController
within services
rer
The logic of the time-system revolves around the GameTime
and TimeController
classes and follows an observer design pattern.