2026-07-09 예시
This commit is contained in:
@@ -24,6 +24,11 @@ public class EventZone : MonoBehaviour
|
||||
private bool _hasPlayed;
|
||||
private bool _isPlaying;
|
||||
|
||||
// 어떤 EventZone이든 타임라인(컷씬)이 재생 중이면 true.
|
||||
// 컷씬이 NPC의 루트를 직접 움직일 수 있으므로, 재생 중엔 대화 시작을 막는 데 쓴다.
|
||||
public static bool IsAnyPlaying => _playingCount > 0;
|
||||
private static int _playingCount;
|
||||
|
||||
public string ZoneId => string.IsNullOrEmpty(_zoneId) ? name : _zoneId;
|
||||
|
||||
// 잠글 때 켜져 있던 프로바이더만 기록해서, 해제 시 원래 꺼져 있던 것까지 켜지 않도록 한다.
|
||||
@@ -55,6 +60,7 @@ private void OnTriggerEnter(Collider other)
|
||||
}
|
||||
|
||||
_isPlaying = true;
|
||||
_playingCount++;
|
||||
|
||||
if (_lockPlayerControl)
|
||||
LockPlayer(other.transform);
|
||||
@@ -67,7 +73,7 @@ private void OnTriggerEnter(Collider other)
|
||||
private void OnTimelineStopped(PlayableDirector director)
|
||||
{
|
||||
director.stopped -= OnTimelineStopped;
|
||||
_isPlaying = false;
|
||||
if (_isPlaying) { _isPlaying = false; _playingCount--; }
|
||||
UnlockPlayer();
|
||||
}
|
||||
|
||||
@@ -98,7 +104,8 @@ private void OnDestroy()
|
||||
if (_timeline != null)
|
||||
_timeline.stopped -= OnTimelineStopped;
|
||||
|
||||
// 존이 재생 중에 파괴돼도 플레이어가 잠긴 채 남지 않도록
|
||||
// 존이 재생 중에 파괴돼도 전역 카운트/플레이어 잠금이 남지 않도록
|
||||
if (_isPlaying) { _isPlaying = false; _playingCount--; }
|
||||
UnlockPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user