BottledLiquid
A class in Root.Township, Alta.Liquid.
Liquid surface visual for bottles: sets a fill plane on the bottle's shader from how full it is, following the liquid's up direction.
- Listed in Stats, effects, heat and liquid
- Inherits or implements
LiquidSurfaceVisual
Constructors
| Member | What it is |
|---|---|
BottledLiquid() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
7 private and internal fields
| Member | What it is |
|---|---|
private Transform dynamicRendererTransform | Transform of the liquid renderer. |
private float finalLevel | The fill height last worked out. |
private static BottleLiquidMaterialCreator materialCreator | Shared creator for the bottle liquid material and its shader properties. |
private float maximumY | Highest mesh point, relative to the renderer. |
private Mesh mesh | The bottle liquid mesh. |
private float minimumY | Lowest mesh point, relative to the renderer. |
private Vector3[] vertices | Cached vertices of the mesh. |
Methods
| Member | What it is |
|---|---|
protected override void Awake() | Caches the bottle mesh vertices (skipped on a headless server). |
protected override void SetLODRendererPropertyBlockFromLiquid(MaterialPropertyBlock propertyBlock, LiquidData liquid) | Sets the liquid colour on the LOD renderer's property block. |
protected override void SetPropertyBlockFromLiquid(MaterialPropertyBlock propertyBlock, LiquidData liquid) | Sets the liquid colour on the renderer's property block. |
protected override Material SetupMaterialFromLiquidVisualSettings(LiquidVisualData visualSettings, Material materialTemplate) | Creates the bottle liquid material from the visual settings. |
protected override void UpdateVisual() | Works out the fill height between the mesh's lowest and highest points and sends it to the shader. |