Skip to content

Instantly share code, notes, and snippets.

@Moe-Baker
Last active July 25, 2018 04:50
Show Gist options
  • Save Moe-Baker/f59c45d33ce716631cea563c127ca148 to your computer and use it in GitHub Desktop.
Save Moe-Baker/f59c45d33ce716631cea563c127ca148 to your computer and use it in GitHub Desktop.
using ARFC;
public class FPControllerAnimationSpeed : MonoBehaviour
{
public FPController controller;
void Update()
{
var value = controller.Movement.Speed.Magnitude / controller.Movement.Speed.MaxValue;
var scale = 1f;
if (controller.Movement.State.Traverser.Target == controller.Movement.State.Sprint) //Sprint Scale
scale = 1.5f;
else if (controller.Movement.State.Traverser.Target == controller.Movement.State.Crouch) //Crouch Scale
scale = 0.5f;
else if (controller.Movement.State.Traverser.Target == controller.Movement.State.Prone) //Prone Scale
scale = 0.2f;
value *= scale;
Debug.Log(value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment