# Water Effects

A visual effects controller that drives dynamic water ripple shaders based on bobber interaction. It animates shader parameters to simulate realistic water disturbances when the bobber enters or exits the water surface.

{% hint style="warning" %}
This component was created and designed to be used with **MWaterFish** custom shader that comes with the package, if you're implmenting your on water solution you don't need to use this
{% endhint %}

> ✅ **Requires**: A custom water shader that uses the above properties to render ripple/fade effects.\
> 🎯 **Designed for**: Integration with fishing gameplay events (e.g., animation events or state machine triggers).

***

#### 🔧 Inspector Settings

<figure><img src="https://2707882048-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7extQzUzohv5ZZCgCVG8%2Fuploads%2FtBnGU1dVU2FlxFcpw4Mf%2Fimage.png?alt=media&#x26;token=612dc0f1-1bed-4b1c-855a-260ec520952f" alt="" width="366"><figcaption></figcaption></figure>

**Bobber Reference**

* **Bobber**\
  A Global Var `TransformReference` that pointing to the fishing bobber. Used to set the ripple origin in the shader.

**Shader Properties Animation Settings**

* **Enter Water Duration**\
  Time (in seconds) over which the ripple *expands* when the bobber first touches the water. Uses an **ease-out exponential** curve for smooth deceleration.
* **Exit Water Duration**\
  Time (in seconds) over which the ripple *collapses* (via inner hole expansion) when the bobber leaves the water.

***

#### 💡 How It Works

* On **`BobberTouchedWater()`**:
  * Sets the ripple origin to the bobber’s current position.
  * Animates `_FalloffRange` from `0` → original value, creating an expanding ripple.
* On **`BobberExitWater()`**:
  * Animates `_InnerHole` from its original value → `1`, simulating the ripple fading inward until it disappears.
* Uses a **material instance** to avoid modifying the original shader asset.
* Automatically cleans up the material on destruction.

***

#### 🎯 Integration Tips

* Call `BobberTouchedWater()` the moment the bobber hits the water surface (e.g., from a fishing rod animation event).
* Call `BobberExitWater()` when the player starts reeling or the fish escapes.

<figure><img src="https://2707882048-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7extQzUzohv5ZZCgCVG8%2Fuploads%2Fh8Sn8yJ9WFr4eGGCvWRL%2Fimage.png?alt=media&#x26;token=0bd4490b-6509-47a5-afc4-5fc8692bcc38" alt="" width="374"><figcaption></figcaption></figure>

The [**Event Listener** ](https://sunfish-studios.gitbook.io/fishing-for-animal-controller/secondary-components/event-system)is used to respond to events and trigger the responses on **WaterEffects**.
