LiquidChunkVisuals
A class in Root.Township, Alta.Cooking.
Client visuals for the floating chunks in a liquid container (such as stew pieces in a pot), bobbing faster as the liquid heats. Removes itself on headless servers.
- Listed in Crafting and making
- Inherits or implements
MonoBehaviour - Nested types
LiquidChunkData - Documented in Cooking
Constructors
| Member | What it is |
|---|---|
LiquidChunkVisuals() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
9 private and internal fields
| Member | What it is |
|---|---|
private BobbingController bobbingController | Moves the chunk visuals up and down. |
private float bobbingSpeedMultiplier | Scales the liquid's wave speed for the bobbing. |
private float bobbingStrengthMultiplier | Scales the liquid's wave strength for the bobbing. |
private ILiquidContainer container | The liquid container in the parents. |
private List<LiquidChunkVisuals.LiquidChunkData> displayingChunks | Chunk types shown and their visuals per content level. |
private static Dictionary<LiquidVisualChunkDefinition, int> existingLiquidChunks | Scratch counts used while swapping liquids. Shared by all instances. |
private HeatPoint heatPoint | Heat point whose temperature drives the bobbing. Ambient temperature is used if none. |
private int maxPieces | Most content levels that get chunk visuals. |
private float spawnedSizeMultiplier | Scale of spawned chunk visuals. |
Methods
| Member | What it is |
|---|---|
void ClearAllVisuals() | Releases every chunk visual and clears the bobbing controller. |
void CreateVisualForIngredient(LiquidVisualChunkDefinition chunkVisual) | Adds visuals for one chunk type, one set per current content level. |
10 private and internal methods
| Member | What it is |
|---|---|
private void AddNewChunkVisuals(LiquidVisualChunkDefinition chunkVisual, Dictionary<int, List<PooledObject>> newVisuals, int oldLevel, int newLevel) | Spawns chunk visuals for each content level gained, up to maxPieces, and adds them to the bobbing controller. |
private void AddVisualsForNewChunks(LiquidContent oldType, LiquidContent newType) | When the liquid changes, adds visuals for chunk types that are new and removes those no longer present. |
private void Awake() | Hooks the container's level, liquid and destroy events, and the heat point. Destroys itself on headless servers. |
private void CreateVisualBaseOnContent(LiquidContent oldType, LiquidContent newType) | Handler for the contained liquid changing: clears, creates or swaps chunk visuals and sets the bobbing. |
private void ReleaseChunkVisuals(NetworkEntity entity, bool isUnload) | Clears all visuals when the container entity is destroyed. |
private void RemoveChunkVisuals(LiquidVisualChunkDefinition oldChunkVisual) | Removes either one chunk type's visuals, or the visuals for content levels lost. |
private void RemoveChunkVisuals(Dictionary<int, List<PooledObject>> newVisuals, int oldLevel, int newLevel) | Removes either one chunk type's visuals, or the visuals for content levels lost. |
private void UpdateBobbingValuesByTemperature(float temperature) | Sets bobbing strength and speed from the liquid's temperature curves. |
private void UpdateLiquidChunks(ILiquidContainer container, int oldLevel, int newLevel) | Handler for the content level changing: adds or removes visuals, clearing all at level 0. |
private void UpdateTemperature(HeatPoint heatPoint) | Handler for the heat point changing: updates the bobbing. |