PouringParticles
A class in Root.Township, Alta.Liquid.
Pooled particle effect for liquid pouring out of a container, coloured to the liquid. Client side visual.
- Listed in Stats, effects, heat and liquid
- Inherits or implements
PooledObject
Constructors
| Member | What it is |
|---|---|
PouringParticles() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
9 private and internal fields
| Member | What it is |
|---|---|
private float coneRadius | Original cone radius of the particle shape. |
private bool isFullyPouring | True while in full pour (circle) mode. |
private float maxPouringParticleEmission | Original emission rate, the maximum for pouring. |
private float openingRadius | Radius of the container opening, used for full pour. |
private Transform particlesParent | Transform on the container the particles are placed relative to. |
private LiquidParticlesRendererColorer particleSystemRendererColorer | Colours the particle renderer to match the liquid. |
private ParticleSystem.MainModule pouringParticleMainModule | Cached main module of the particle system. |
private ParticleSystem.EmissionModule pouringParticlesEmissionModule | Cached emission module of the particle system. |
private ParticleSystem pouringParticleSystem | The particle system. |
Properties
| Member | What it is |
|---|---|
IPourableContainer PourableContainer { get; private set; } | The container these particles are pouring from, or null when free. |
Methods
| Member | What it is |
|---|---|
void PlacePouringParticlesOnLip(float containerLipRadius) | Moves the effect to the lowest point of the container lip. |
void PourFully(float pouringStrength) | Switches to a circle shape over the whole opening and sets emission by strength. |
override void Release() | Unparents, stops the particles and returns to the pool once they finish. |
void ResetToNormalPouringMode() | Restores the cone shape and radius. |
void SetupForPourableContainer(IPourableContainer liquidContainer, Transform particlesParent, float openingRadius) | Claims the particles for a container, colours them and listens for liquid changes. Logs an error if already claimed. |
void UpdatePouringStrength(float currentPouringStrength) | Sets emission to the maximum times the strength, leaving full pour mode if needed. |
7 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Caches the particle modules and restarts the particles each time the object is taken from the pool. |
private void ContainerLiquidTypeChanged(LiquidContent oldType, LiquidContent newType) | Recolours the particles when the container's liquid changes. |
private void ResetBeforeRelease() | Unhooks from the container and resets shape and emission. |
private void SetupPouringParticles() | Caches the emission and main modules, maximum emission and cone radius. |
private void SetupToFullyPour() | Sets the shape to a circle the size of the opening at the parent position. |
private void StartParticlesAgain(PooledObject pooledObject) | Plays the particle system again after being taken from the pool. |
private IEnumerator WaitForParticleSystemToRelease() (iterator) | Stops emitting, waits the particle duration, then resets and releases to the pool. |
Used in
Members of other types that take, return or hold a PouringParticles: