float WaterLevel { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The WaterLevel property represents the extent to which a character is submerged in water within the MoveModeSwim class. This value is dynamically updated based on the character's interaction with triggers tagged as "water" in the game environment.

Usage

Use the WaterLevel property to determine how much of the character is submerged in water. This can be useful for adjusting movement speed, applying buoyancy effects, or triggering specific animations or sound effects when the character is swimming.

Example

// Example of accessing the WaterLevel property

// Assuming 'swimMode' is an instance of MoveModeSwim
float currentWaterLevel = swimMode.WaterLevel;

// Use the water level to adjust character behavior
if (currentWaterLevel > 0.5f)
{
    // Character is more than halfway submerged
    // Apply specific swimming behavior
}