Custom Motion

Extend your custom motion from StateMotion and override one of the follwing methods.

//Can the motion be started?
public virtual bool CanStart()
{
	return true;
}

//Called when the motion is started
public virtual void OnStart()
{

}

//Update the velocity for rigidbody. Return true if damping should be applied. 
public virtual bool UpdateVelocity (ref Vector3 velocity)
{
	return true;
}

//Update rotation. Return true if default rotation should be applied. 
public virtual bool UpdateRotation ()
{
	return true;
}

//Send values to the animator controller. 
public virtual bool UpdateAnimator ()
{
	return true;
}

//Do any IK operations
public virtual bool UpdateAnimatorIK (int layer)
{
	return true;
}

//Check for the ground
public virtual bool CheckGround ()
{
	return true;
}

//Can the motion be stopped?
public virtual bool CanStop()
{
	return true;
}

//Called when the motion is stopped.
public virtual void OnStop ()
{
		
}

You can also extend existing motions. In this example the ChangeHeight motion will do all the work on resizing the capsule collider. I have only added a check if the character is running, he should slide first and then go to crouch motion.

using DevionGames;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace DevionGames
{
    public class Slide : ChangeHeight
    {
        public override bool CanStart()
        {
            return base.CanStart() && Controller.RelativeInput.z*Controller.SpeedMultiplier > 1f;
        }

    }
}

Your Animator Controller and Slide motion would look like this: