first
This commit is contained in:
20
Assets/02_Scripts/Story/CharacterSlot.cs
Normal file
20
Assets/02_Scripts/Story/CharacterSlot.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using UnityEngine;
|
||||
|
||||
// 장소 프리팹 안의 캐릭터 자리 하나.
|
||||
// 이 캐릭터가 지금 이 장소에서 걸 수 있는 대화(StoryBeat)가 하나라도 있으면 캐릭터를 켜고, 없으면 끈다.
|
||||
// 갱신은 LocationManager가 장소 입장 시 / 스토리 상태 변화 시 Refresh를 호출해서 이뤄진다.
|
||||
//
|
||||
// 배치법: 이 컴포넌트는 항상 켜져 있는 빈 오브젝트에 붙이고,
|
||||
// 캐릭터 본체(CharacterVoiceObject + DialogPlayer)는 그 자식으로 두고 _character에 연결.
|
||||
// 참고: 조건 없는 잡담 비트를 하나 등록해 두면 그 캐릭터는 항상 등장한다.
|
||||
public class CharacterSlot : MonoBehaviour
|
||||
{
|
||||
[Tooltip("캐릭터 본체 (CharacterVoiceObject + DialogPlayer가 붙은 자식 오브젝트)")]
|
||||
[SerializeField] private CharacterVoiceObject _character;
|
||||
|
||||
public void Refresh(StoryDatabase database, LocationData location)
|
||||
{
|
||||
if (_character == null || _character.Character == null) return;
|
||||
_character.gameObject.SetActive(database.HasPlayableBeat(location, _character.Character));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user