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

View File

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

View File

@@ -1,13 +1,33 @@
using HighlightPlus;
using UnityEngine;
using UnityEngine.AI;
public class InteractableSit : MonoBehaviour,IInteractable
public class InteractableSit : MonoBehaviour, IInteractable
{
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()
{
if(interactionOnOff)
if (interactionOnOff)
{
//메인카메라를 기준으로 좌표 변환
Vector3 pos = Camera.main.WorldToScreenPoint(transform.position + Vector3.up * 0.5f);
@@ -19,13 +39,19 @@ private void Update()
public void InteractOpen()
{
if (interactionOnOff == true) return;
interactionOnOff = true;
ActiveEffect(true);
GameManager.Instance.InGameUI.Interaction.OnOffSitBox(true);
}
public void InteractClose()
{
if (interactionOnOff == false) return;
interactionOnOff = false;
ActiveEffect(false);
GameManager.Instance.InGameUI.Interaction.OnOffSitBox(false);
}
@@ -33,5 +59,27 @@ public void InteractExec(PlayerCharacterController player)
{
player.PointSitAction(this.transform);
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 UnityEngine;
using UnityEngine.InputSystem;
@@ -24,6 +25,9 @@ public class GameManager : MonoBehaviour
public float ItemBounceAmplitude = 0.1f; // 오르내리는 높이
public float ItemBounceFrequency = 2f; // 오르내리는 속도
[Header("Global Refer")]
public HighlightProfile InteractionHighlightProfile;
private void Awake()
{
if (Instance == null)

View File

@@ -1,3 +1,5 @@
using NUnit.Framework;
using System.Collections.Generic;
using Unity.Cinemachine;
using UnityEditor.Rendering;
using UnityEngine;
@@ -5,6 +7,7 @@
public class CameraManager : MonoBehaviour
{
[SerializeField] private List<CameraRigBase> _cameraRigList;
private CameraRigBase _currentCameraRig; //현재 활성화된 플레이어의 카메라 묶음 조종객체
private float minFOV = 40f;
@@ -49,7 +52,14 @@ public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
public void SetCameraRig(CameraRigBase cameraRig)
{
foreach(CameraRigBase crb in _cameraRigList)
{
crb.Priority = 10;
}
_currentCameraRig = cameraRig;
_currentCameraRig.Priority = 15;
}
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)
{
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 List<IInteractable> InteractionTargets = new List<IInteractable>();
public IInteractable InteractionOnTarget = null;
private bool _actionExitRequested = false;
//무기
@@ -137,6 +138,8 @@ private void Update()
WorkGravity();
ApplyMove();
CheckInteraction();
TickTimer();
//PlayerDebug();
}
@@ -456,7 +459,8 @@ public void EndAction()
_ = Util.RunDelayed(FreezeTime, () => {
_stateMachine.ChangeState(PlayerState.Idle);
RotationMode = PlayerRotationMode.CameraCoupled;
GameManager.Instance.InGameUI.InteractionVisible(true);
InteractionOnTarget.InteractEnd(this);
InteractionOnTarget = null;
}, default);
}
#endregion
@@ -589,8 +593,7 @@ public void InteractInput()
if (InteractionTargets.Count > 0)
{
IInteractable target = InteractionTargets[0];
target.InteractExec(this); // 실제 상호작용 실행
InteractionOnTarget.InteractExec(this); // 실제 상호작용 실행
RotationMode = PlayerRotationMode.CameraDecoupled;
}
@@ -651,16 +654,32 @@ private bool ActionExitCheck()
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)
{
// 상호작용 객체인지 확인
if (other.TryGetComponent<IInteractable>(out IInteractable interactable))
{
Debug.Log($"interactableName : {interactable}");
interactable.InteractOpen();
if (InteractionTargets.Contains(interactable)) return;
InteractionTargets.Add(interactable);
return;
}
}