예제 #1
0
 // Update is called once per frame
 void Update()
 {
     //if (Input.GetMouseButtonDown(0))
     if (CustomController.GetButtonDown(Constants.TakePicture))
     {
         if (cameraSnap == null || CameraReady == false)
         {
             return;
         }
         cameraSnap.SnapShutter();
         TakePicture();
         if (cameraSFX != null)
         {
             cameraSFX.Play();
         }
         if (picText != null)
         {
             picText.text = (allPics.Length - picIndex).ToString();
         }
     }
     if (CustomController.GetButtonDown(Constants.ReadyCamera))
     {
         ReadyCamera();
     }
     if (CustomController.GetButtonUp(Constants.ReadyCamera))
     {
         UnReadyCamera();
     }
 }
예제 #2
0
        //add on method to support crouching
        //reduce height if player pressed crouch button, return to normal on release
        private void HandleCrouch()
        {
            if (CustomController.GetButtonDown(Constants.CrouchButton) && !IsCrouching)
            {
                transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y / 2.0f, transform.localScale.z);
                IsCrouching          = true;
                //reduce speed while crouching
                m_WalkSpeed /= 2.0f;
            }

            if (CustomController.GetButtonUp(Constants.CrouchButton) && IsCrouching)
            {
                transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y * 2.0f, transform.localScale.z);
                IsCrouching          = false;
                //return to normal speed
                m_WalkSpeed *= 2.0f;
            }
        }