live2D (sdk가 6.5 미지원으로 sprite로 대응)

This commit is contained in:
2026-08-08 22:13:54 +09:00
parent 9ce6930772
commit 8a4a001fe0
4278 changed files with 287426 additions and 18 deletions

View File

@@ -26,7 +26,8 @@ public class DialogPlayer : MonoBehaviour
// 대화 중 포즈를 바꾼 캐릭터들의 원래 포즈 — 대화 종료 시 전부 복원.
// (끼어든 다른 NPC의 포즈도 포함되므로 Animator와 같은 방식으로 딕셔너리에 추적한다)
private readonly Dictionary<CharacterPoses, Pose> _touchedPoses = new();
// 키가 인터페이스라 스프라이트 인물과 Live2D 인물이 한 딕셔너리에 섞여 들어간다.
private readonly Dictionary<ICharacterPoses, Pose> _touchedPoses = new();
public bool IsPlaying { get; private set; }
// 지금 실제 대사를 재생 중인 DialogPlayer (전역 1개) — 이때 다른 NPC의 Play()는 무시된다.
@@ -425,19 +426,26 @@ private void ApplyStageVisuals(DialogNode node)
poses.Apply(node.Pose);
}
// 포즈를 적용할 대상의 CharacterPoses. 그 캐릭터가 지금 씬에 없으면 null.
// 포즈를 적용할 대상의 포즈 구현. 그 캐릭터가 지금 씬에 없으면 null.
// 제스처/표정과 달리 화자를 전혀 보지 않는다 — 대상은 노드가 명시한 것 하나뿐이다.
private static CharacterPoses FindPoses(CharacterData target)
// 스프라이트(CharacterPoses)든 Live2D(CubismCharacterPoses)든 인터페이스로 받으므로
// 대화 그래프는 그 인물이 어느 쪽인지 알 필요가 없다.
private static ICharacterPoses FindPoses(CharacterData target)
{
var obj = CharacterVoiceObject.Find(target);
return obj != null ? obj.GetComponentInChildren<CharacterPoses>(includeInactive: true) : null;
return obj != null ? obj.GetComponentInChildren<ICharacterPoses>(includeInactive: true) : null;
}
// 대화 중 포즈를 바꾼 모든 캐릭터(끼어든 NPC 포함)를 원래 포즈로 복원
private void RestoreDefaultPoses()
{
foreach (var kvp in _touchedPoses)
if (kvp.Key != null) kvp.Key.Apply(kvp.Value);
{
// 인터페이스 참조로는 Unity의 "파괴됨" 검사가 안 걸린다(그냥 C# 널 비교가 된다).
// 씬 전환으로 오브젝트가 사라졌을 수 있으므로 Object로 보고 확인한다.
if (kvp.Key as UnityEngine.Object != null)
kvp.Key.Apply(kvp.Value);
}
_touchedPoses.Clear();
}