대화구조 수정

This commit is contained in:
2026-07-30 13:20:13 +09:00
parent 2413483853
commit 519e351fa5
15 changed files with 778 additions and 17 deletions

View File

@@ -8,8 +8,18 @@ public class CharacterVoiceObject : MonoBehaviour
private static readonly Dictionary<CharacterData, CharacterVoiceObject> _registry = new();
private void OnEnable() => _registry[Character] = this;
private void OnDisable() => _registry.Remove(Character);
// Character를 비워 두면 Dictionary 널 키로 예외가 나므로 등록하지 않는다.
// (화자 없는 대화는 CharacterVoiceObject 자체를 붙이지 않는 씬 플레이어로 처리한다)
private void OnEnable()
{
if (Character != null) _registry[Character] = this;
else Debug.LogWarning($"[CharacterVoiceObject] Character가 비어 있어 등록하지 않음: {name}");
}
private void OnDisable()
{
if (Character != null) _registry.Remove(Character);
}
public static CharacterVoiceObject Find(CharacterData data)
=> _registry.TryGetValue(data, out var obj) ? obj : null;