Skip to main content

CookingLiquid

A class in Root.Township, Alta.Cooking.

The liquid inside a cooking pot: links the pot's liquid container to its heat point, boiling visuals and sounds. Found on the cooking pot prefab under an ILiquidContainer.

Constructors​

MemberWhat it is
CookingLiquid()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

5 private and internal fields
MemberWhat it is
private ILiquidContainer liquidContainerBacking field for LiquidContainer.
private CookingLiquidVisual potLiquidThe liquid visual: surface and boiling effect.
private AudioControl spawnedAudioPrivate: the playing boiling sound.
private RTPCValue temperatureRTPCValuePrivate: Wwise parameter fed the water temperature for the boiling sound.
private CookingPoint waterHeatPointBacking field for HeatPoint. A CookingPoint holding the water temperature.

Properties​

MemberWhat it is
HeatPoint HeatPoint { get; }The heat point that holds the water's temperature.
bool IsNotEmpty { get; }True when the parent liquid container has any content.
bool IsRejectingMoreLiquid { get; set; }Set by CookingPot to stop more liquid being added, for example while it holds a stew.
ILiquidContainer LiquidContainer { get; }The liquid container found in the parent objects.
Transform Surface { get; }The transform at the visible liquid surface. Boiling sounds play from here.
float Temperature { get; }The current water temperature from the heat point.

Events​

MemberWhat it is
event Action LiquidAddedServer: raised when the content level goes up, after the water's temperature is pulled to ambient.
event Action LiquidEmptiedServer: raised when liquid is removed and the container is now empty.
event Action WaterRemovedServer: raised whenever the content level goes down.

Methods​

MemberWhat it is
void ConvertContainerLiquidToStewLiquid(LiquidContent stewLiquidContent)Replaces the container's content with the given stew liquid. Called by StewManager when a stew forms.
override void Initialize()Hooks scene destroy so the pooled boiling sound is released.
8 private and internal methods
MemberWhat it is
private void AdjustWaterTemperature()Private: pulls the water heat point fully to ambient temperature when water is added.
private void Awake()Finds the liquid container in the parents and hooks its level changes and the heat point's changes.
private void LiquidContainerContentLevelChanged(ILiquidContainer container, int oldLevel, int newLevel)Private, server: raises LiquidAdded, WaterRemoved or LiquidEmptied as the level changes. Clients unhook on the first change.
private void ReceivedWater()Private: resets the water temperature and raises LiquidAdded.
private void ReleasePooledAudio()Private: stops the boiling sound. Called when the entity is destroyed.
private void Start()Private: sets the starting boil effect and prepares the temperature sound parameter.
private void UpdateLiquidSounds(float temperature)Private, client: plays or updates the boiling sound once the water is above the minimum stewing temperature.
private void UpdateWaterBoilingEffects(HeatPoint heatPoint)Private: updates the boil visuals and sound when the heat point changes.

Used in​

Members of other types that take, return or hold a CookingLiquid: