protected Vector2 GetDirectionVector(XYAxisState axisState)
 {
     return((
                axisState.IsInHorizontalSensitivityDeadZone() &&
                PlayerController.IsFacingRight()
                ) ||
            axisState.XAxis > 0f
   ? Vector2.right
   : -Vector2.right);
 }
    public override PlayerStateUpdateResult GetPlayerStateUpdateResult(XYAxisState axisState)
    {
        if ((PlayerController.PlayerState & PlayerState.Crouching) == 0)
        {
            return(PlayerStateUpdateResult.Unhandled);
        }

        if (axisState.IsInHorizontalSensitivityDeadZone())
        {
            return(PlayerStateUpdateResult.CreateHandled("PlayerCrouchIdle"));
        }

        return(PlayerStateUpdateResult.CreateHandled("PlayerCrouchRun"));
    }
    private string GetAnimationName(XYAxisState axisState)
    {
        if ((PlayerController.PlayerState & PlayerState.ClimbingLadder) != 0)
        {
            return("Climb And Shoot");
        }

        if (PlayerController.IsAirborne())
        {
            return("Airborne And Shoot");
        }

        if (axisState.IsInHorizontalSensitivityDeadZone())
        {
            return("Stand And Shoot");
        }

        return("Run And Shoot");
    }
Example #4
0
    public override PlayerStateUpdateResult GetPlayerStateUpdateResult(XYAxisState axisState)
    {
        if (!PlayerController.IsGrounded())
        {
            return(PlayerStateUpdateResult.Unhandled);
        }

        if (PlayerController.CrouchSettings.EnableCrouching)
        {
            var result = _crouchController.UpdatePlayerState(axisState);

            if (result.IsHandled)
            {
                return(result);
            }
        }

        if (axisState.IsInHorizontalSensitivityDeadZone())
        {
            return(PlayerStateUpdateResult.CreateHandled("Idle"));
        }

        return(PlayerStateUpdateResult.CreateHandled("Run Start", linkedAnimationNames: new string[] { "Run" }));
    }