void OnModeBegin()

book_4_sparkGenerated
code_blocksInput

Description

The OnModeBegin method is a virtual method in the MoveModeSwim class, which is part of the Sandbox.Movement namespace. This method is called when the swimming mode is initiated for a character. It is intended to be overridden in derived classes to provide specific behavior when the swimming mode begins.

Usage

Override the OnModeBegin method in a subclass of MoveModeSwim to implement custom logic that should occur when the swimming mode is activated. This could include initializing variables, setting up animations, or other preparatory actions specific to the swimming mode.

Example

public class CustomSwimMode : MoveModeSwim
{
    public override void OnModeBegin()
    {
        base.OnModeBegin();
        // Custom logic for when swimming mode begins
        // e.g., play swimming animation, reset swim speed, etc.
    }
}