Exemple #1
0
    // 앉은 상태, 서 있는 상태 변경 함수
    private void Crouch()
    {
        /* 앉은 상태의 변형 */
        isCrouch = !isCrouch;
        /* 크로스 헤어에 상태 적용  */
        theCrossHair.CrouchingAnimation(isCrouch);
        Debug.Log(isCrouch);
        /* 앉아 있을 경우, 앉은 속도와 카메라 위치 변경 */
        if (isCrouch)
        {
            applySpeed      = crouchSpeed;
            applyCrouchPosY = CrouchPosY;
        }
        /* 서 잇을 경우, 서 있는 속도(걷는 속도)와 카메라 위치 변경 */
        else
        {
            applySpeed      = walkSpeed;
            applyCrouchPosY = originPosY;
        }

        /*
         * 카메라의 지역 위치에서 Y 축 위치만 변경함
         * -> 자연스러운 카메라 이동을 위해 코루틴 함수로 변경
         */
        StartCoroutine(CrouchCoroutine());
    }
    private void Crouch()
    {
        isCrouch = !isCrouch;// true면 false로 false면  true로
        theCrossHair.CrouchingAnimation(isCrouch);

        if (isCrouch)//true
        {
            applySpeed = crouchSpeed;
            applyCrouchPosY = crouchPosY;
        }
        else
        {
            applySpeed = walkSpeed;
            applyCrouchPosY = originPosY;
        }
        StartCoroutine(CrouchCoroutine());
    }
Exemple #3
0
    private void Crouch()
    {
        isCrouch = !isCrouch; //true <-> false

        theCrossHair.CrouchingAnimation(isCrouch);

        if (isCrouch)
        {
            appplySpeed     = crouchSpeed;
            applyCrouchPosY = crouchPosY;
        }
        else
        {
            appplySpeed     = walkSpeed;
            applyCrouchPosY = originPosY;
        }

        /*theCamera.transform.localPosition = new Vector3(theCamera.transform.localPosition.x,
         *  applyCrouchPosY,
         *  theCamera.transform.localPosition.z);*/

        StartCoroutine(CrounchCoroutine());
    }