Skip to main content

PotionVisuals

A class in Root.Township, the global namespace.

Client: visuals for a potion bottle. Tints and shows the bubbling particles to match its liquid and sets up the splash when it breaks.

Constructors​

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

Fields​

3 private and internal fields
MemberWhat it is
private ColoredPooledParticleSpawner breakParticleSpawnerSpawns the splash when the potion breaks.
private ILiquidContainer containerThe potion's liquid container.
private ColoredParticleSystem poppingParticlesBubbling particles inside the bottle.

Methods​

3 private and internal methods
MemberWhat it is
private void Awake()Finds the liquid container, hooks its changes and the break spawner, and hides the bubbles.
private void LiquidChanged(LiquidContent oldType, LiquidContent newType)Shows and tints the bubbles and allows the break splash when there is liquid; hides them when empty.
private void SetSplashParticlesContainer(PooledObject obj)Links spawned splash particles to this container.