설정수정
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -34,6 +34,42 @@ public void SetZone(Zone zone)
|
|||||||
|
|
||||||
public void OnSceneLoaded()
|
public void OnSceneLoaded()
|
||||||
{
|
{
|
||||||
|
ResolveZoneAtSpawn();
|
||||||
|
}
|
||||||
|
|
||||||
|
//씬 로드 직후, 플레이어가 서 있는 위치에서 ZoneTrigger를 직접 조회해 구역을 확정한다.
|
||||||
|
//None을 깔고 OnTriggerEnter를 기다리는 방식의 BGM 글리치/누락(스폰 즉시 트리거 안인 경우)을 피하기 위함.
|
||||||
|
private void ResolveZoneAtSpawn()
|
||||||
|
{
|
||||||
|
Zone resolved = Zone.None;
|
||||||
|
|
||||||
|
var player = GameObject.FindGameObjectWithTag("Player");
|
||||||
|
if (player != null)
|
||||||
|
{
|
||||||
|
//콜라이더는 Awake/OnEnable에서 이미 물리씬에 등록되므로 첫 물리 스텝 전에도 즉시 조회 가능
|
||||||
|
Collider[] hits = Physics.OverlapSphere(
|
||||||
|
player.transform.position, 0.1f, ~0, QueryTriggerInteraction.Collide);
|
||||||
|
|
||||||
|
foreach (var hit in hits)
|
||||||
|
{
|
||||||
|
if (hit.TryGetComponent<ZoneTrigger>(out var trigger))
|
||||||
|
{
|
||||||
|
resolved = trigger.Zone;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SetZone(resolved); //이전 구역과 같으면 dedup되어 BGM이 끊김 없이 이어진다
|
||||||
|
}
|
||||||
|
|
||||||
|
//게임 종료 (에디터에서는 플레이 모드 중지, 빌드에서는 앱 종료)
|
||||||
|
public void QuitGame()
|
||||||
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
UnityEditor.EditorApplication.isPlaying = false;
|
||||||
|
#else
|
||||||
|
Application.Quit();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,6 +149,18 @@ private async Awaitable SightFadeAsync(float targetAlpha, CancellationToken toke
|
|||||||
catch (OperationCanceledException) { }
|
catch (OperationCanceledException) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GameManager를 통해 게임을 종료한다. (UI 버튼·타임라인 시그널 등에서 호출)
|
||||||
|
public void QuitGame()
|
||||||
|
{
|
||||||
|
if (GameManager.Instance == null)
|
||||||
|
{
|
||||||
|
Debug.LogWarning("[PlayerController] GameManager.Instance가 없습니다. 게임을 종료할 수 없습니다.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameManager.Instance.QuitGame();
|
||||||
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
// 바닥 체크 및 Y축 속도 초기화
|
// 바닥 체크 및 Y축 속도 초기화
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ public class ZoneTrigger : MonoBehaviour
|
|||||||
[SerializeField] private Zone _zone; //이 영역이 나타내는 구역
|
[SerializeField] private Zone _zone; //이 영역이 나타내는 구역
|
||||||
[SerializeField] private string _playerTag = "Player"; //플레이어로 인식할 태그
|
[SerializeField] private string _playerTag = "Player"; //플레이어로 인식할 태그
|
||||||
|
|
||||||
|
//스폰 위치 판정 등에서 외부가 이 트리거의 구역을 읽을 수 있도록 노출
|
||||||
|
public Zone Zone => _zone;
|
||||||
|
|
||||||
private void Reset()
|
private void Reset()
|
||||||
{
|
{
|
||||||
//이 컴포넌트를 붙이면 콜라이더를 자동으로 트리거로 설정
|
//이 컴포넌트를 붙이면 콜라이더를 자동으로 트리거로 설정
|
||||||
|
|||||||
14
Assets/08_Timeline/Signals/Sig_QuitGame.signal
Normal file
14
Assets/08_Timeline/Signals/Sig_QuitGame.signal
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: d6fa2d92fc1b3f34da284357edf89c3b, type: 3}
|
||||||
|
m_Name: Sig_QuitGame
|
||||||
|
m_EditorClassIdentifier: Unity.Timeline::UnityEngine.Timeline.SignalAsset
|
||||||
8
Assets/08_Timeline/Signals/Sig_QuitGame.signal.meta
Normal file
8
Assets/08_Timeline/Signals/Sig_QuitGame.signal.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9b02eaa2955e72b4294be05e52c90129
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -41,7 +41,7 @@ MonoBehaviour:
|
|||||||
m_Start: 4
|
m_Start: 4
|
||||||
m_ClipIn: 0
|
m_ClipIn: 0
|
||||||
m_Asset: {fileID: 8000411283881595332}
|
m_Asset: {fileID: 8000411283881595332}
|
||||||
m_Duration: 5
|
m_Duration: 7
|
||||||
m_TimeScale: 1
|
m_TimeScale: 1
|
||||||
m_ParentTrack: {fileID: -4088094050139152046}
|
m_ParentTrack: {fileID: -4088094050139152046}
|
||||||
m_EaseInDuration: 0
|
m_EaseInDuration: 0
|
||||||
@@ -134,6 +134,23 @@ MonoBehaviour:
|
|||||||
m_Objects:
|
m_Objects:
|
||||||
- {fileID: 4070348831193287581}
|
- {fileID: 4070348831193287581}
|
||||||
- {fileID: -5316700233391951052}
|
- {fileID: -5316700233391951052}
|
||||||
|
- {fileID: -393883030560430518}
|
||||||
|
--- !u!114 &-393883030560430518
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 15c38f6fa1940124db1ab7f6fe7268d1, type: 3}
|
||||||
|
m_Name: Signal Emitter
|
||||||
|
m_EditorClassIdentifier: Unity.Timeline::UnityEngine.Timeline.SignalEmitter
|
||||||
|
m_Time: 10.5
|
||||||
|
m_Retroactive: 0
|
||||||
|
m_EmitOnce: 0
|
||||||
|
m_Asset: {fileID: 11400000, guid: 9b02eaa2955e72b4294be05e52c90129, type: 2}
|
||||||
--- !u!114 &11400000
|
--- !u!114 &11400000
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user