/// <summary> /// Convert stance id to animation id. /// </summary> /// <param name="stance">The id of the stance.</param> /// <param name="standingAnim">True if it's standing, or else moving.</param> /// <returns>Id of the animation.</returns> private AnimationId GetAnimationFromStance(StanceId stance, bool standingAnim = true) { switch (stance) { case StanceId.Crouching: if (standingAnim) { return(AnimationId.Crouching); } else { return(AnimationId.CrouchingWalk); } case StanceId.CrouchingLow: if (standingAnim) { return(AnimationId.CrouchingLow); } else { return(AnimationId.CrouchingLowWalk); } default: if (standingAnim) { return(AnimationId.Standing); } else { return(AnimationId.Walk); } } }
/// <summary> /// Takes care of crouch states /// </summary> private void HandleCrouchStates(float crouchRotation) { if (crouchRotation < 0.85f) { currentStance = StanceId.CrouchingLow; } else if (crouchRotation < 1.4f) { currentStance = StanceId.Crouching; } else { currentStance = StanceId.Standing; } }