ADD : 카메라 컨트롤 시스템 간의 추가

This commit is contained in:
KINDNICK 2025-09-27 00:03:05 +09:00
parent 7c3d0af9be
commit 6ac6bd357d
3 changed files with 93 additions and 4 deletions

View File

@ -43,7 +43,7 @@ public class CameraControlSystem : MonoBehaviour
// Beautify Volume Override 참조
private object beautifyOverride;
private Volume currentVolume;
private bool isDOFEnabled = false; // DOF 활성화 상태 (기본값: 꺼짐)
private void Awake()
{
@ -144,6 +144,9 @@ public class CameraControlSystem : MonoBehaviour
case RawKey.F17:
ToggleCameraUI();
break;
case RawKey.F18:
ToggleDOF();
break;
case RawKey.F19:
Debug.Log("[CameraControlSystem] F19 키 입력 감지 (RawInput)");
CycleDOFSpeed();
@ -182,6 +185,10 @@ public class CameraControlSystem : MonoBehaviour
{
ToggleCameraUI();
}
else if (Input.GetKeyDown(KeyCode.F18))
{
ToggleDOF();
}
// DOF 제어 (F19-F21)
if (Input.GetKeyDown(KeyCode.F19))
@ -534,6 +541,12 @@ public class CameraControlSystem : MonoBehaviour
return;
}
if (!isDOFEnabled)
{
Debug.Log("[CameraControlSystem] DOF가 비활성화되어 있어서 조작 불가");
return;
}
// 현재 DOF를 targetDOF로 초기화 (처음 호출 시)
if (!isApplyingDofForce)
{
@ -558,6 +571,12 @@ public class CameraControlSystem : MonoBehaviour
return;
}
if (!isDOFEnabled)
{
Debug.Log("[CameraControlSystem] DOF가 비활성화되어 있어서 조작 불가");
return;
}
// 현재 DOF를 targetDOF로 초기화 (처음 호출 시)
if (!isApplyingDofForce)
{
@ -595,7 +614,7 @@ public class CameraControlSystem : MonoBehaviour
private void UpdateDOFPhysics()
{
if (beautifyOverride == null) return;
if (beautifyOverride == null || !isDOFEnabled) return;
var currentDOF = GetCurrentDOFValue();
if (!currentDOF.HasValue) return;
@ -837,7 +856,8 @@ public class CameraControlSystem : MonoBehaviour
"depthOfFieldForegroundBlur", // 전경 블러
"depthOfFieldMaxSamples", // 최대 샘플
"depthOfFieldDownsampling", // 다운샘플링
"depthOfFieldMaxBrightness" // 최대 밝기
"depthOfFieldMaxBrightness", // 최대 밝기
"depthOfFieldFocalLength" // 포커스 렌즈 길이
};
foreach (string fieldName in dofFieldsToEnable)
@ -860,7 +880,7 @@ public class CameraControlSystem : MonoBehaviour
switch (fieldName)
{
case "depthOfField":
valueProperty.SetValue(fieldValue, true);
valueProperty.SetValue(fieldValue, false); // 기본값: 비활성화
break;
case "depthOfFieldDistance":
@ -896,6 +916,13 @@ public class CameraControlSystem : MonoBehaviour
valueProperty.SetValue(fieldValue, 1000f);
}
break;
case "depthOfFieldFocalLength":
if (valueProperty.PropertyType == typeof(float))
{
valueProperty.SetValue(fieldValue, 0.3f); // 포커스 렌즈 길이 0.3
}
break;
}
}
}
@ -950,6 +977,34 @@ public class CameraControlSystem : MonoBehaviour
}
}
private void ToggleDOF()
{
if (beautifyOverride == null) return;
isDOFEnabled = !isDOFEnabled;
var overrideType = beautifyOverride.GetType();
var dofField = overrideType.GetField("depthOfField");
if (dofField != null)
{
var fieldValue = dofField.GetValue(beautifyOverride);
if (fieldValue != null)
{
var valueProperty = fieldValue.GetType().GetProperty("value");
var overrideProperty = fieldValue.GetType().GetProperty("overrideState");
if (valueProperty != null && overrideProperty != null)
{
overrideProperty.SetValue(fieldValue, true);
valueProperty.SetValue(fieldValue, isDOFEnabled);
Debug.Log($"[CameraControlSystem] DOF {(isDOFEnabled ? "" : "")}");
}
}
}
}
// Public 메서드들 (외부에서 호출 가능)
public void SetFOV(float fov)
{

View File

@ -8,6 +8,19 @@ public class InputHandler : MonoBehaviour
private bool isMiddleMouseHeld;
private bool isOrbitActive;
private bool isZoomActive;
// 카메라 컨트롤 시스템 참조
private CameraControlSystem cameraControlSystem;
private void Start()
{
// CameraControlSystem 찾기
cameraControlSystem = FindObjectOfType<CameraControlSystem>();
if (cameraControlSystem == null)
{
Debug.LogWarning("[InputHandler] CameraControlSystem을 찾을 수 없습니다.");
}
}
private void Update()
{
@ -44,4 +57,15 @@ public class InputHandler : MonoBehaviour
{
return Input.mousePosition;
}
// 카메라 컨트롤 시스템 관련 메서드들
public CameraControlSystem GetCameraControlSystem()
{
return cameraControlSystem;
}
public bool IsFunctionKeyPressed(KeyCode keyCode)
{
return Input.GetKeyDown(keyCode);
}
}

View File

@ -97,6 +97,16 @@ public class RawKeySetup
{ KeyCode.F10, RawKey.F10 },
{ KeyCode.F11, RawKey.F11 },
{ KeyCode.F12, RawKey.F12 },
{ KeyCode.F13, RawKey.F13 },
{ KeyCode.F14, RawKey.F14 },
{ KeyCode.F15, RawKey.F15 },
{ KeyCode.F16, RawKey.F16 },
{ KeyCode.F17, RawKey.F17 },
{ KeyCode.F18, RawKey.F18 },
{ KeyCode.F19, RawKey.F19 },
{ KeyCode.F20, RawKey.F20 },
{ KeyCode.F21, RawKey.F21 },
{ KeyCode.F22, RawKey.F22 },
// 방향키
{ KeyCode.UpArrow, RawKey.Up },