Skip to content

CookingComponent

willembor edited this page Aug 29, 2024 · 14 revisions

Introduction

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.

Initialising the Component

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();

Methods

  • 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

Attributes

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.

Events

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.

Timing

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.

UML Class Diagram

image

Table of Contents

Home

Team Design Document

Game Features

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

Game

Getting Started

Entities and Components

World Backstory

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Map Design

Test Plans

Sensor Component

Customer Sensor Component

Interaction Component

Inventory Component

Inventory Display

Station Meal Component

Station Progress Display

Keyboard Input Component

Fire Extinguisher Handler Component

Score System

HoverBox Component

MainGameActions Create Docket Triggers

End Day Display Component

Cutscene Area

Docket

Docket Line Display

Docket Meal Display

Main Game Order Button Display

Order Actions

Recipe

Ticket Details Component

BackstoryCutscene Test Plan

BackstoryCutsceneDisplay Test Plan

Test Plan for Tutorial

Keybinds

Keybinds Test Plan

Test Plan for MainGameOrderTicketDisplay

Test Plan for MainGameOrderBtnDisplay

Test Plan for Docket

Test Plan for DocketLineDisplay

Test Plan for OrderActions

Ticket Details

Test plan for RandomComboService

Test plan for LoanUpgrade

Test plan for UpgradesDisplay

Test plan for RageUpgrade

Test plan for SpeedBoostUpgrade

Test plan for DancePartyUpgrade

Test plan for ExtortionUpgrade

Troubleshooting

MacOS Setup Guide

Clone this wiki locally