Beispiel #1
0
    void RunStatusPhysics()
    {
        switch (status)
        {
        case Status.idle:
            movement.ApplyFriction(friction);
            movement.ApplyGravity(gravity);
            break;

        case Status.walking:
            movement.ApplyFriction(friction);
            movement.Walk(input.InputDir(), walkSpeed, walkSpeedIncrease, ref moveRampUpCounter, moveRampUpTime);
            movement.ApplyGravity(gravity);
            break;

        case Status.crouching:
            movement.ApplyFriction(friction);
            movement.Walk(input.InputDir(), crouchSpeed, 0, ref moveRampUpCounter, moveRampUpTime);
            movement.ApplyGravity(gravity);
            break;

        case Status.sliding:
            movement.ApplyFriction(friction / slideFrictionMod);
            movement.Slide(groundDetector.isGrounded ? slideStrenght : slideStrenght * 2, groundDetector.isGrounded);
            movement.ApplyGravity(gravity);
            break;

        case Status.wallrunning:
            movement.ApplyFriction(friction);
            movement.Wallrun(wallrunDetector.contactR, input.moveInputDir.y, wallrunSpeed, wallrunDetector.wallNormal);
            movement.ApplyGravity(wallrunGravity);
            break;

        case Status.airborne:
            movement.ApplyFriction(friction / airFrictionMod);
            movement.AirControl(input.InputDir(), airControlSpeed);
            movement.ApplyGravity(gravity);
            break;

        case Status.climbing:
            movement.ApplyFriction(friction);
            movement.Climb(input.InputDir(), climbSpeed);
            movement.ApplyGravity(climbGravity);
            movement.ApplyVerticalFriction(climbFriction);
            break;

        case Status.dashholding:
            movement.ApplyFriction(friction / airFrictionMod);
            movement.AirControl(input.InputDir(), airControlSpeed);
            movement.ApplyGravity(gravity);
            movement.Dashhold(input.InputDir(), dashHoldMoveSpeed);
            break;
        }
    }