Description
The Controller
property of the MoveMode
class provides access to the PlayerController
associated with the current movement mode. This property is essential for managing and interacting with the player's movement logic within the game environment.
Usage
To use the Controller
property, you must have an instance of a class that derives from MoveMode
. The property is read-only and provides access to the PlayerController
component, which is required for the movement mode to function correctly.
Ensure that the PlayerController
component is attached to the game object using this movement mode, as indicated by the RequireComponent
attribute.
Example
// Example of accessing the Controller property in a derived MoveMode class
public class CustomMoveMode : MoveMode
{
public override void OnModeBegin()
{
base.OnModeBegin();
// Access the PlayerController through the Controller property
PlayerController playerController = this.Controller;
// Perform operations with playerController
}
}