Cooking system & held items - Team-Swamp/IceBites GitHub Wiki
Overview
The main mechanic of the game is cooking. It's a system that lets you hold ingredients and dishes, cook some fish, and combine ingredients. Below is a flowchart of how to make every dish. This is the activity that the player engages in during gameplay: preparing dishes to serve to customers.
Usage
Dishes flowchart
---
title: Dishes flowchart.
---
flowchart TD
Sushi([Sushi])
FT([Fish taco])
FB([Fish burger])
IC([Iced coffee])
IT([Iced tea])
IW([Iced water])
FS([Fish smoothie])
C([Cupcake])
Blender-->FS
Coffee-machine-->IC;
Coffee-machine-->IT;
Coffee-machine-->IW;
Display-window-->C;
Cooked-fish-->FB;
Get-ingredient-from-basket-->Raw-fish;
Raw-fish-->|Grill|Cooked-fish;
Get-ingredient-from-basket-->Bread;
Bread-->FB;
Get-ingredient-from-basket-->Tacoshell;
Tacoshell-->FT;
Cooked-fish-->FT;
Get-ingredient-from-basket-->Seaweed;
Raw-fish-->Sushi;
Seaweed-->Sushi;
UML
---
title: Cooking
---
classDiagram
class HeldItem {
}
class IngredientObjectEditor {
- SerializedProperty _ingredient
- SerializedProperty _cookedMat
- SerializedProperty _onBeingPrepared
- SerializedProperty _onCooked
+ OnInspectorGUI()
- OnEnable()
}
class DishManager {
- GameObject displayDish
- List<IngredientObject> ingredients
- UnityEvent onDishMade
+ AddIngredient(IngredientObject target)
+ CanMakeDish(IngredientObject target) : bool
+ SetDishPosition(Vector3 targetPos)
- CanMakeDish(IngredientObject target) : (bool, GameObject)
- MakeDish()
- SetParent()
}
class InteractableObject {
+ UnityEvent onInteract
}
class IngredientBasket {
- GameObject ingredient
- ItemHolding player
+ GiveIngredient()
}
class IngredientObject {
+ DishManager parent
- Ingredient ingredient
- Material cookedMat
- IngredientState _state
+ IngredientState() IngredientState - getter
- UnityEvent onBeingPrepared
- UnityEvent onCooked
+ ChangeState(int targetState)
+ ChangeState(IngredientState targetState)
+ CookFish(IngredientObject fish)
}
class KitchenAppliance {
- const string NEW_DISH_NAME
- bool useTimer
- GameObject newDishGameObject
- Transform ingredientPosition
- ItemHolding player
- DishManager dishManager
- IngredientObject ingredientObject
- Timer _timer
- GameObject _dishGameObject
- Awake()
+ SetOrPickUpItem()
+ SetIngredient()
+ RemoveIngredient()
+ ChangeCurrentIngredientState(int targetState)
+ ChangeCurrentIngredientState(IngredientState targetState)
+ CookFish()
+ GiveHeldItem()
- Grill()
- CreateDish()
- FillDish(IngredientObject targetIngredient)
}
class RecipesHolder {
- Recipe[] recipes
+ Recipes() Recipe[] - getter
}
class Singleton {
+ get : T
# Awake()
}
class Recipe {
ScriptableObject:
+ Ingredient firstIngredient
+ Ingredient secondIngredient
+ GameObject dishModel
}
class ItemHolding {
- Transform heldItemPosition
- HeldItem currentItem
+ CurrentItem() HeldItem - get / set
+ SetHeldItem(HeldItem targetHeldItem)
+ CreateHeldItem(GameObject targetHeldItem)
}
class Ingredient-state{
Enum:
RAW,
BEING_PREPARED,
COOKED
}
class Ingredient-type{
Enum:
NONE,
FISH_RAW,
FISH_COOKED,
BREAD,
TACO_SHELL,
SEAWEED
}
class Dish-type{
Enum:
SUSHI,
FISH_SANDWICH,
FISH_TACO,
CUPCAKE,
ICED_COFFEE,
ICED_TEA,
ICED WATER
}
HeldItem <|-- DishManager
Recipe --> RecipesHolder
HeldItem --> ItemHolding
KitchenAppliance <--> ItemHolding
IngredientBasket <--> ItemHolding
RecipesHolder <-- IngredientObject
HeldItem <|-- IngredientObject
InteractableObject <|-- IngredientBasket
IngredientObject --|> Ingredient-state
IngredientObject --|> Ingredient-type
Recipe --|> Ingredient-type
DishManager--|> Dish-type
InteractableObject <|-- KitchenAppliance
Singleton <|-- RecipesHolder
IngredientObjectEditor .. IngredientObject