-
Notifications
You must be signed in to change notification settings - Fork 2
CookingComponent
The CookingComponent class is an integral part of the cooking functionality of the game. This class predominantly handles the process of transforming raw or ‘uncooked’ ingredients in a station and consequently cooking that item. Additionally, this class interacts with the base game’s event system to listen for when an item is added and removed from a station.
In order to function, CookingComponent requires an instance of StationInventoryComponent to be attached to the same entity.
newEntity = new Entity();
inventoryComponent = new StationInventoryComponent();
newEntity.addComponent(inventoryComponent);
cookingComponent = new CookingComponent();
newEntity.addComponent(cookingComponent);
newEntity.create();
-
create()
- Initialises the component and adds event listeners -
update()
- Handles cooking process by using GameTime to decrement the cooking time -
addItem(item)
- Adds item to station and begins cooking process -
removeItem()
- Removes item from station and stops cooking process -
isCooking(
) - returns true if the station is currently cooking items -
getCookingTime()
- gets the time remaining until the recipe is cooked -
getTargetRecipe()
- gets the recipe being cooked
Attribute | Type | Description |
---|---|---|
inventoryComponent |
StationInventoryComponent |
Tracks the StationInventoryComponent attached to this component’s entity. |
gameTime |
GameTime |
Used for timing. |
cookingTime |
long |
The time (in seconds) remaining until the recipe is cooked. |
isCooking |
boolean |
A flag to tell whether the station is currently cooking food or not. |
targetRecipe |
String |
The name of the dish to be made once cooking is complete. |
CookingComponent uses the same event names as StationItemHandlerComponent for adding and removing items from the station respectively. This is so that calling either event triggers the respective method in both components.
A countdown timer system was used so that the remaining cooking time can be accessed publicly for future use - eg a UI progress bar or for tracking how cooked each item is.
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