Table of Contents

Class PuddlecraftController

Namespace
DFA.Puddlecraft

Scene controller for Puddlecraft: the bridge between your weather and the rendering. Holds the rain state, the rain preset (the look), which layers get wet and which block rain, the rain cover and the bakes. One per scene.

[ExecuteAlways]
[DisallowMultipleComponent]
[AddComponentMenu("Puddlecraft/Puddlecraft Controller")]
[Icon("Packages/com.dfa.puddlecraft/editor/icons/puddlecraft.png")]
public sealed class PuddlecraftController : PuddlecraftBehaviour
Inheritance
PuddlecraftController

Properties

active

The first enabled controller, or null.

public static PuddlecraftController active { get; }

Property Value

PuddlecraftController

assignedPreset

The assigned rain preset, or null.

public RainPreset assignedPreset { get; }

Property Value

RainPreset

bakeData

The saved puddle bake used in builds. Written by the editor when the scene is saved.

public PuddlecraftBakeData bakeData { get; }

Property Value

PuddlecraftBakeData

bakeLayers

Layers the bakes and the placement tools use, on top of receiverLayers and occluderLayers. The realtime rain cover, ripples and puddle queries are not affected.

public LayerMask bakeLayers { get; set; }

Property Value

LayerMask

bakeStaticOnly

Whether the bakes (placed puddles, the baked rain cover, drip edge and spout landings) and the placement tools only use renderers marked Static, so things that move don't shape them from where they stood while baking. The realtime rain cover is not affected.

public bool bakeStaticOnly { get; set; }

Property Value

bool

coverData

The baked rain cover map, used when the cover mode is Baked.

public RainCoverData coverData { get; set; }

Property Value

RainCoverData

coverMode

Where the rain cover map comes from: baked in the editor, or drawn at runtime around each camera.

public RainCoverMode coverMode { get; set; }

Property Value

RainCoverMode

maxSlope

Placed puddles fade out on surfaces steeper than this, in degrees (0 to 60), and are gone 10 degrees steeper. The Puddle Populator places none on them.

public float maxSlope { get; set; }

Property Value

float

occluderLayers

Layers that block rain from reaching a surface, such as roofs, awnings, trees and bridges.

public LayerMask occluderLayers { get; set; }

Property Value

LayerMask

preset

The rain preset in use: the assigned one, or built-in default settings (with no rain particles) when none is assigned.

public RainPreset preset { get; set; }

Property Value

RainPreset

rain

The weather: how hard it rains and the water it leaves behind. Set its values to drive the weather.

public RainState rain { get; }

Property Value

RainState

rainParticles

The particle rain spawned from the preset in Play mode, or null. Set its followCamera to choose the camera it falls around (the main camera by default).

public PuddlecraftRain rainParticles { get; }

Property Value

PuddlecraftRain

realtimeCover

Settings for the realtime rain cover map, used when the cover mode is Realtime.

public RealtimeCoverSettings realtimeCover { get; }

Property Value

RealtimeCoverSettings

receiverLayers

Layers that puddles, drips and spouts can land on. Used by the bakes, the realtime rain cover, the ripples and puddle queries.

public LayerMask receiverLayers { get; set; }

Property Value

LayerMask

skyConeAngle

Half-angle, in degrees (0 to 89), of the cone around straight up that rain can arrive from. Used by the puddle bake and the Puddle Populator.

public float skyConeAngle { get; set; }

Property Value

float

waterFeatureDistance

In Play mode, drip edges and spouts farther than this from every camera the rain falls around (the main camera, with no particle rain) stop firing landing events, splashes and ripples, in metres (0 or more); they are still drawn. 0 simulates them everywhere.

public float waterFeatureDistance { get; set; }

Property Value

float

Methods

SetRainIntensity(float)

Sets how hard it rains, 0 (dry) to 1 (downpour). The same as setting rain.intensity, as a method so a UI Slider's On Value Changed, or any other UnityEvent with a float, can drive the rain without code.

public void SetRainIntensity(float intensity)

Parameters

intensity float