2026-04-03 인트로 타임라인, 카메라 Rig 오작동 수정, 하이라이트 투과설정 수정

해야할 것 : 버리기(dynamicObjects에 버리기),아이템 다 사용했을때 없애기
This commit is contained in:
2026-04-03 05:17:44 +09:00
parent dddc685f33
commit 7e19e4f248
15 changed files with 126 additions and 36 deletions

Binary file not shown.

View File

@@ -5,4 +5,5 @@ public interface IInteractable
public void InteractOpen(); public void InteractOpen();
public void InteractClose(); public void InteractClose();
public void InteractExec(PlayerCharacterController player); public void InteractExec(PlayerCharacterController player);
public void InteractEnd(PlayerCharacterController player);
} }

View File

@@ -1,13 +1,33 @@
using HighlightPlus;
using UnityEngine; using UnityEngine;
using UnityEngine.AI; using UnityEngine.AI;
public class InteractableSit : MonoBehaviour,IInteractable public class InteractableSit : MonoBehaviour, IInteractable
{ {
private bool interactionOnOff = false; private bool interactionOnOff = false;
[SerializeField] private GameObject _interactionObject;
private HighlightProfile _highlightProfile;
private HighlightEffect _highlightEffect;
private void Awake()
{
_highlightEffect = _interactionObject.GetComponent<HighlightEffect>();
if (_highlightEffect == null)
{
_highlightEffect = _interactionObject.AddComponent<HighlightEffect>();
}
}
private void Start()
{
_highlightProfile = GameManager.Instance.InteractionHighlightProfile;
_highlightEffect.ProfileLoad(_highlightProfile);
_highlightEffect.highlighted = false;
}
private void Update() private void Update()
{ {
if(interactionOnOff) if (interactionOnOff)
{ {
//메인카메라를 기준으로 좌표 변환 //메인카메라를 기준으로 좌표 변환
Vector3 pos = Camera.main.WorldToScreenPoint(transform.position + Vector3.up * 0.5f); Vector3 pos = Camera.main.WorldToScreenPoint(transform.position + Vector3.up * 0.5f);
@@ -19,13 +39,19 @@ private void Update()
public void InteractOpen() public void InteractOpen()
{ {
if (interactionOnOff == true) return;
interactionOnOff = true; interactionOnOff = true;
ActiveEffect(true);
GameManager.Instance.InGameUI.Interaction.OnOffSitBox(true); GameManager.Instance.InGameUI.Interaction.OnOffSitBox(true);
} }
public void InteractClose() public void InteractClose()
{ {
if (interactionOnOff == false) return;
interactionOnOff = false; interactionOnOff = false;
ActiveEffect(false);
GameManager.Instance.InGameUI.Interaction.OnOffSitBox(false); GameManager.Instance.InGameUI.Interaction.OnOffSitBox(false);
} }
@@ -33,5 +59,27 @@ public void InteractExec(PlayerCharacterController player)
{ {
player.PointSitAction(this.transform); player.PointSitAction(this.transform);
GameManager.Instance.InGameUI.InteractionVisible(false); GameManager.Instance.InGameUI.InteractionVisible(false);
ActiveEffect(false);
}
public void InteractEnd(PlayerCharacterController player)
{
GameManager.Instance.InGameUI.InteractionVisible(true);
if (interactionOnOff)
{
ActiveEffect(true);
}
}
public void ActiveEffect(bool isOn)
{
if(isOn)
{
_highlightEffect.highlighted = true;
}
else
{
_highlightEffect.highlighted = false;
}
} }
} }

View File

@@ -1,3 +1,4 @@
using HighlightPlus;
using System; using System;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
@@ -24,6 +25,9 @@ public class GameManager : MonoBehaviour
public float ItemBounceAmplitude = 0.1f; // 오르내리는 높이 public float ItemBounceAmplitude = 0.1f; // 오르내리는 높이
public float ItemBounceFrequency = 2f; // 오르내리는 속도 public float ItemBounceFrequency = 2f; // 오르내리는 속도
[Header("Global Refer")]
public HighlightProfile InteractionHighlightProfile;
private void Awake() private void Awake()
{ {
if (Instance == null) if (Instance == null)

View File

@@ -1,3 +1,5 @@
using NUnit.Framework;
using System.Collections.Generic;
using Unity.Cinemachine; using Unity.Cinemachine;
using UnityEditor.Rendering; using UnityEditor.Rendering;
using UnityEngine; using UnityEngine;
@@ -5,6 +7,7 @@
public class CameraManager : MonoBehaviour public class CameraManager : MonoBehaviour
{ {
[SerializeField] private List<CameraRigBase> _cameraRigList;
private CameraRigBase _currentCameraRig; //현재 활성화된 플레이어의 카메라 묶음 조종객체 private CameraRigBase _currentCameraRig; //현재 활성화된 플레이어의 카메라 묶음 조종객체
private float minFOV = 40f; private float minFOV = 40f;
@@ -49,7 +52,14 @@ public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
public void SetCameraRig(CameraRigBase cameraRig) public void SetCameraRig(CameraRigBase cameraRig)
{ {
foreach(CameraRigBase crb in _cameraRigList)
{
crb.Priority = 10;
}
_currentCameraRig = cameraRig; _currentCameraRig = cameraRig;
_currentCameraRig.Priority = 15;
} }
public CinemachineCamera GetLiveCinemachineCamera() public CinemachineCamera GetLiveCinemachineCamera()

View File

@@ -16,6 +16,13 @@ public override void GetInputAxes(List<IInputAxisOwner.AxisDescriptor> axes)
protected override CinemachineVirtualCameraBase ChooseCurrentCamera(Vector3 worldUp, float deltaTime) protected override CinemachineVirtualCameraBase ChooseCurrentCamera(Vector3 worldUp, float deltaTime)
{ {
return (CinemachineVirtualCameraBase)LiveChild; CinemachineVirtualCameraBase Cam;
if (LiveChild == null)
Cam = GetHighestPriorityCamera();
else
Cam = (CinemachineVirtualCameraBase)LiveChild;
return Cam;
} }
} }

View File

@@ -80,6 +80,7 @@ public enum PlayerRotationMode {CameraCoupled, CameraDecoupled}
//상호작용 //상호작용
public SphereCollider InteractionCollider; public SphereCollider InteractionCollider;
public List<IInteractable> InteractionTargets = new List<IInteractable>(); public List<IInteractable> InteractionTargets = new List<IInteractable>();
public IInteractable InteractionOnTarget = null;
private bool _actionExitRequested = false; private bool _actionExitRequested = false;
//무기 //무기
@@ -137,6 +138,8 @@ private void Update()
WorkGravity(); WorkGravity();
ApplyMove(); ApplyMove();
CheckInteraction();
TickTimer(); TickTimer();
//PlayerDebug(); //PlayerDebug();
} }
@@ -456,7 +459,8 @@ public void EndAction()
_ = Util.RunDelayed(FreezeTime, () => { _ = Util.RunDelayed(FreezeTime, () => {
_stateMachine.ChangeState(PlayerState.Idle); _stateMachine.ChangeState(PlayerState.Idle);
RotationMode = PlayerRotationMode.CameraCoupled; RotationMode = PlayerRotationMode.CameraCoupled;
GameManager.Instance.InGameUI.InteractionVisible(true); InteractionOnTarget.InteractEnd(this);
InteractionOnTarget = null;
}, default); }, default);
} }
#endregion #endregion
@@ -589,8 +593,7 @@ public void InteractInput()
if (InteractionTargets.Count > 0) if (InteractionTargets.Count > 0)
{ {
IInteractable target = InteractionTargets[0]; InteractionOnTarget.InteractExec(this); // 실제 상호작용 실행
target.InteractExec(this); // 실제 상호작용 실행
RotationMode = PlayerRotationMode.CameraDecoupled; RotationMode = PlayerRotationMode.CameraDecoupled;
} }
@@ -651,16 +654,32 @@ private bool ActionExitCheck()
return _actionExitRequested; return _actionExitRequested;
} }
private void CheckInteraction()
{
if(InteractionTargets.Count > 0)
{
for(int i=0; i < InteractionTargets.Count;i++)
{
if(i == 0)
{
InteractionOnTarget = InteractionTargets[i];
InteractionOnTarget.InteractOpen();
}
else
InteractionTargets[i].InteractClose();
}
}
}
private void OnTriggerEnter(Collider other) private void OnTriggerEnter(Collider other)
{ {
// 상호작용 객체인지 확인 // 상호작용 객체인지 확인
if (other.TryGetComponent<IInteractable>(out IInteractable interactable)) if (other.TryGetComponent<IInteractable>(out IInteractable interactable))
{ {
Debug.Log($"interactableName : {interactable}"); if (InteractionTargets.Contains(interactable)) return;
interactable.InteractOpen();
InteractionTargets.Add(interactable); InteractionTargets.Add(interactable);
return;
} }
} }

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2748cbcb641350b4fae289694ce88c93
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 493987b86f2291f4d9cf4d673548d7fa
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -74,25 +74,7 @@ MonoBehaviour:
m_RotationOrder: 4 m_RotationOrder: 4
m_MixOutCurve: m_MixOutCurve:
serializedVersion: 2 serializedVersion: 2
m_Curve: m_Curve: []
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2 m_PreInfinity: 2
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4

Binary file not shown.