jheredia / pack-it-up

Frantic packing action game about a group of backpackers working together to complete their trip while trying to keep their luggage and sanity.
1 stars 1 forks source link

Game state manager and game manager #13

Closed jheredia closed 2 weeks ago

jheredia commented 2 weeks ago

First iteration of game manager and game state manager.

Game Manager

The game manager will be the first thing that the game loads, it is a singleton and it will be in charge of handling the menus and level transitions.

In this game manager we will instantiate and setup all the other independent systems (Inventory, Timer, Level Generator, Game State Manager, Player Controllers).

[!IMPORTANT] TODO: Right now it starts the game right away, once we have the menus then we need to connect the ui buttons via events to either exit the game (Close everything), show credits (Show a little lovely message from the dev team), start game (Send a OnGameStart event). Window events and UI might be moved to another manager soonish

[!IMPORTANT] Mocks were added to avoid compilation errors and to give a sense of the wiring we should do.

Game State Manager

GameStateManager will be the game object in charge of managing the game loop inside a single level, it's only job is to react to events from other systems (i.e. timer, inventory) and update the game state machine.

It sends event when the level objectives are completed, when the player fails and when the player succeeds. It reacts to the game start from the game manager (Kicking of the actual level, though this might be moved to the game manager instead), it reacts to the inventory system telling it that the players collected all key items, it reacts to the end zone when any player enters it and to the timer when it runs out.