Skip to main content

LiquidContainerTrigger

A class in Root.Township, Alta.Liquid.

Trigger inside a liquid container (a bucket, a pot, the river) that tracks objects dipped into the liquid, plays splashes, and on the server fills a dipped container when it is pulled out.

Constructors​

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

Fields​

9 private and internal fields
MemberWhat it is
private Dictionary<Rigidbody, ILiquidContainer> handledLiquidContainersLiquid containers inside the trigger, by rigidbody.
private Dictionary<Rigidbody, Pickup> handledPickupsPickups inside the trigger, by rigidbody.
private Dictionary<Rigidbody, IPourableContainer> handledPourableLiquidContainersPourable containers marked as submerged, by rigidbody.
private Dictionary<Rigidbody, int> handledRigidbodiesRigidbodies inside the trigger and how many of their colliders are in.
private bool isPlayingSplashParticlesWhether to play splash effects (default true).
private bool isSurfaceStaticFor still water like the river: uses a simpler way to place splashes.
private static Logger loggerNLog logger for this class.
private Transform surfaceTransformThe liquid surface: the cooking liquid's surface if there is one, else the trigger's parent.
private ILiquidContainer thisContainerThe liquid container this trigger belongs to.

Methods​

MemberWhat it is
void OnTriggerEnter(Collider other)Tracks a rigidbody entering; marks lower-priority pourable containers as submerged, and plays a splash for pickups and containers.
void OnTriggerExit(Collider other)When the last collider of a rigidbody leaves, stops tracking it.
6 private and internal methods
MemberWhat it is
private void Awake()Finds the parent liquid container and its surface, and turns the trigger on or off by whether it holds liquid.
private void ContainerContentLevelChanged(ILiquidContainer container, int oldLevel, int newLevel)Turns the trigger off and forgets tracked objects when the container is empty, and back on when it has liquid.
private void FillOtherContainer(ILiquidContainer otherContainer)Server: fills a lower-priority container that left the liquid with as much as fits and is available.
private void PlayLiquidSplashParticles(Collider otherObj)Plays a splash in the liquid's colours, and the splash sound, where the object meets the surface.
private void RemoveDockedPickupFromLiquidTrigger(Interactor arg1, Pickup pickup, PickupDock arg3)Stops tracking a pickup that got docked while in the liquid.
private void RemoveRigidbodyFromLiquidTriggerArea(Rigidbody attachedRigidbody)Stops tracking a rigidbody, clears its submerged flag and, on the server, fills it if it is a container.

Used in​

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