class MAGES::CharacterController::AnimatorController

Overview

The MAGESAnimator class, handles all Animation related code. More…

class AnimatorController
{
public:
    // enums

    enum AnimationDurationType;

    // structs

    struct MAGESAnimationData;

    // properties

    Animator CharacterAnimator;
    List IdleList;
    List OnPlayListOverride;
    List OnPlayListAdditive;
    SerializableDictionary LayersDictionary;
    string LastOverrideAnimationPlayed;
    string LastAdditiveAnimationPlayed;
    int OverrideLayerIndex;
    int AdditiveLayerIndex;

    // methods

    void InitGameObject(GameObject gameObject);
    IEnumerator PlayIdles();
    void PlayAnimationSequence(List<MAGESAnimationData> animations);

    void PlayAnimation(
        string animationName,
        AnimationDurationType durType = AnimationDurationType.Persistent,
        float normalizedTimeOffset = -1f,
        float animationSpeed = 1f
    );

    void PlayAnimationReverse(
        string animationName,
        AnimationDurationType durType = AnimationDurationType.Persistent,
        float normalizedTimeOffset = -1f,
        float animationSpeed = 1f
    );

    void StopAllOnPlayAnimations(bool layerReset = true);
    Motion GetMotionFromList(string name);
    float GetAnimationLength(Motion motion);
    float GetAnimationLength(string animationName);

    Coroutine SmoothChangeLayerWeight(
        int layerIndex,
        float newWeight,
        float seconds
    );
};

Detailed Documentation

The MAGESAnimator class, handles all Animation related code.

Properties

Animator CharacterAnimator

Gets or sets the CharacterAnimator.

List IdleList

Gets or sets the idleList.

List OnPlayListOverride

Gets or sets the list with the override on play animations.

List OnPlayListAdditive

Gets or sets the list with the additive on play animations.

SerializableDictionary LayersDictionary

Gets or sets the LayersDictionary.

string LastOverrideAnimationPlayed

Gets the last override animation played.

string LastAdditiveAnimationPlayed

Gets the last additive animation played.

int OverrideLayerIndex

Gets the override layer Index.

int AdditiveLayerIndex

Gets the additive layer Index.

Methods

void InitGameObject(GameObject gameObject)

Sets the gameObject for the animator Controller.

Parameters:

gameObject

The GameObject.

IEnumerator PlayIdles()

Plays the Idle Animations.

Returns:

Enumerator.

void PlayAnimationSequence(List<MAGESAnimationData> animations)

Plays animations in order.

Parameters:

animations

The list of animations that will play in order.

void PlayAnimation(
    string animationName,
    AnimationDurationType durType = AnimationDurationType.Persistent,
    float normalizedTimeOffset = -1f,
    float animationSpeed = 1f
)

Plays an animation.

Parameters:

animationName

The animation name to be played.

durType

Whether the animation will be persistent or momentary.

normalizedTimeOffset

The normalized time offset.

animationSpeed

The speed the animation plays.

void PlayAnimationReverse(
    string animationName,
    AnimationDurationType durType = AnimationDurationType.Persistent,
    float normalizedTimeOffset = -1f,
    float animationSpeed = 1f
)

Plays an animation in Reverse.

Parameters:

animationName

The animation name to be played.

durType

Whether the animation will be persistent or momentary.

normalizedTimeOffset

The normalized time offset.

animationSpeed

The speed the animation plays.

void StopAllOnPlayAnimations(bool layerReset = true)

Stops all OnPlay animations, that could be playing right now.

Parameters:

layerReset

Bool value whether the layer will reset or not.

Motion GetMotionFromList(string name)

Gets Motion from OnPlay List.

Parameters:

name

Th name of the animation

Returns:

motion.

float GetAnimationLength(Motion motion)

Gets the length of an animation.

Parameters:

motion

The animation.

Returns:

Length.

float GetAnimationLength(string animationName)

Gets the animation length of an animation.

Parameters:

animationName

The animaton name.

Returns:

animation length.

Coroutine SmoothChangeLayerWeight(
    int layerIndex,
    float newWeight,
    float seconds
)

Smoothly changes the weight of a specific layer.

Parameters:

layerIndex

The layer index.

newWeight

The new weight.

seconds

The seconds needed.

Returns:

Coroutine instance.