PlateComponent - UQcsse3200/2024-studio-3 GitHub Wiki

Table of Contents

Introduction

Coding

   UML

   Usage Summary

   Description

   Coding Choices

   Introduction

      Inspiration and Theory

Introduction

The PlateComponent is game component designed to manage the behavior of plates within the game environment, inspired by mechanics from games like Overcooked. The PlateComponent is interactable.

Key functionalities include:

   •	Spawning individual plates with id.
   •	Handling the state of the plate (clean, dirty). 

Coding

UML

Below is Rough UML Diagram of related components of the PlateComponent for reference.

image

Usage summary

To spawn a PlateComponent, the ItemFactory method createPlate() can be used to create a plate with id of 0. In game, this is done as part of the Dishwasher Component functionality.

Screenshot from 2024-10-17 14-21-09

Screenshot from 2024-10-17 14-21-16

Coding Choices

Entity Component System is utilized for the code to be rendered on screen and also backend. The PlateComponent extends ItemComponent as it was added to an entity. They are able to be interacted with (pick up, put down on a bench, etc) as required by the Meal Creation cycle.

Inspiration and Theory

The design of the PlateComponent is inspired by the game Overcooked, where they are interactable items.

As per picture below we can see plates are can be picked up and put on benches.

The PlateComponent follows the ECS pattern, where behavior is defined by components attached to entities. This decouples functionality and allows for flexible and reusable game mechanics.

The plate’s state transitions between DIRTY and CLEAN, each state triggering different interactions and constraints.