// 앉기 동작 private void Crouch() { // 스위치 역할 isCrouch = !isCrouch; theCrosshair.CrouchingAnimation(isCrouch); if (isCrouch) { applySpeed = crouchSpeed; applyCrouchPosY = crouchPosY; } else { applySpeed = walkSpeed; applyCrouchPosY = originPosY; } if (isWalk) { isWalk = false; theCrosshair.WalkingAnimation(isWalk); } // y값 혼자 수정 불가능, 고로 벡터째로 수정해야함 /* theCamera.transform.localPosition = new Vector3(theCamera.transform.localPosition.x, * applyCrouchPosY, * theCamera.transform.localPosition.z); */ StartCoroutine(CrouchCoroutine()); }
// 앉기 private void Crouch() { isCrouch = !isCrouch; theCrosshair.CrouchingAnimation(isCrouch); if (isCrouch) { _applySpeed = crouchSpeed; applyCrouchPosY = crouchPosY; } else { _applySpeed = walkSpeed; applyCrouchPosY = originPosY; } StartCoroutine(CrouchCoroutine()); }
// 앉기 (스위치 함수) private void Crouch() { isCrouch = !isCrouch; theCrosshair.CrouchingAnimation(isCrouch); if (isCrouch) { applySpeed = crouchSpeed; applyCrouchPosY = crouchPosY; } else { applySpeed = walkSpeed; applyCrouchPosY = originPosY; } StartCoroutine(CrouchCoroutine()); //theCamera.transform.localPosition = new Vector3(theCamera.transform.localPosition.x, applyCrouchPosY, theCamera.transform.localPosition.z); }
// 앉기 동작 private void Crouch() { isCrouch = !isCrouch; // == if(isCrouch) 일 경우 isCrouch = false --> 서로 반전 시켜주는걸 1줄로 완성 theCrosshair.CrouchingAnimation(isCrouch); if (isCrouch) { applySpeed = crouchSpeed; // 앉을 때 스피드 달라짐 applyCrouchPosY = crouchPosY; } else { applySpeed = walkSpeed; // 일어섰을 때 스피드 달라짐 applyCrouchPosY = originPosY; } // 코루틴으로 변경한다. theCamera.transform.localPosition = new Vector3(theCamera.transform.localPosition.x, applyCrouchPosY, theCamera.transform.localPosition.z); // 벡터 값은 카메라는 현재 x값, 현재 z값, 바뀔 y값을 가지게 된다 StartCoroutine(CrouchCorotuine()); }
//앉는 동작 private void Crouch() { isCrouch = !isCrouch; // 이 한줄이 밑에 조건문이랑 같은 역할. (앉아있으면 일어나게, 일어나있으면 앉아있게..) //if (isCrouch) // isCrouch = false; //else // isCrouch = true; theCrosshair.CrouchingAnimation(isCrouch); if (isCrouch) //앉을때 { applySpeed = crouchSpeed; applyCrouchPosY = crouchPosY; } else //서있을때 { applySpeed = walkSpeed; applyCrouchPosY = originPosY; } StartCoroutine(CrouchCoroutine()); //theCamera.transform.localPosition = new Vector3(theCamera.transform.localPosition.x, applyCrouchPosY, theCamera.transform.localPosition.z); }