예제 #1
0
 public void Sprint()
 {
     //Making the player sprint
     if (Input.GetKey(KeyCode.LeftShift) && !isCrouching && !isProne && playerStamina.getStamina() > 15f)
     {
         //Changing the variables according to the new state of the player
         playerMovement.playerSpeed = sprintSpeed;
         playerFootsteps.volumeMin  = sprintVolume;
         playerFootsteps.volumeMax  = sprintVolume;
         playerFootsteps.stepLength = sprintDistance;
         isSprinting = true;
         weaponManager.WalkinAnimation(false);
         weaponManager.SprintingAnimation(true);
     }
     //Makng the player not sprint
     else if (!Input.GetKey(KeyCode.LeftShift) && !isCrouching && !isProne)
     {
         //Changing the variables according to the new state of the player
         playerMovement.playerSpeed = moveSpeed;
         playerFootsteps.volumeMin  = walkVolumeMin;
         playerFootsteps.volumeMax  = walkVolumeMax;
         playerFootsteps.stepLength = walkDistance;
         isSprinting = false;
         //weaponManager.WalkinAnimation(true);
         weaponManager.SprintingAnimation(false);
     }
     else if (Input.GetKey(KeyCode.LeftShift) && !isCrouching && !isProne && playerStamina.getStamina() < 15f)
     {
         //Changing the variables according to the new state of the player
         playerMovement.playerSpeed = moveSpeed;
         playerFootsteps.volumeMin  = walkVolumeMin;
         playerFootsteps.volumeMax  = walkVolumeMax;
         playerFootsteps.stepLength = walkDistance;
         isSprinting = false;
         weaponManager.WalkinAnimation(true);
         weaponManager.SprintingAnimation(false);
     }
 }
    void SteadyAim()
    {
        if (Input.GetKeyDown(KeyCode.LeftShift) && isAiming && !playerMovement.getMovementState() && playerStamina.getStamina() > 0f)
        {
            weaponManager.SteadyAimWeaponInAnimation();
            zoomCameraAnimator.SetBool("isSteady", true);
            mainCameraAnimator.Play("MainCameraSteadyAimIn");
            mainCameraAnimator.SetBool("isSteadyMain", true);
            isSteadyAim = true;
        }
        else if (Input.GetKeyUp(KeyCode.LeftShift) && isAiming || !isAiming || playerMovement.getMovementState() || playerStamina.getStamina() <= 0)
        {
            weaponManager.SteadyAimWeaponOutAnimation();
            zoomCameraAnimator.SetBool("isSteady", false);
            if (!mainCameraAnimator.GetBool("isWalking") && !mainCameraAnimator.GetBool("isSteadyMain"))
            {
                mainCameraAnimator.Play("Idle");
            }
            else if (mainCameraAnimator.GetBool("isSteadyMain"))
            {
                mainCameraAnimator.Play("MainCameraSteadyAimOut");
                mainCameraAnimator.SetBool("isSteadyMain", false);
            }


            isSteadyAim = false;
        }
    }