2026-04-13 스킬,퀵슬롯 시스템 수정중
This commit is contained in:
41
Assets/02_Scripts/UI/QuickSlot/QuickSlotController.cs
Normal file
41
Assets/02_Scripts/UI/QuickSlot/QuickSlotController.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class QuickSlotController : MonoBehaviour
|
||||
{
|
||||
private QuickSlot[] _slots;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_slots = GetComponentsInChildren<QuickSlot>(true);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
foreach (var slot in _slots)
|
||||
{
|
||||
if (string.IsNullOrEmpty(slot.SlotName)) continue;
|
||||
QuickSlot captured = slot;
|
||||
GameManager.Instance.Level.BindSlotAction(captured.SlotName, (state) => captured.Execute(state));
|
||||
}
|
||||
}
|
||||
|
||||
// 외부(스킬창/SkillModule 등)에서 슬롯에 등록할 때 호출
|
||||
public void RegisterEntry(string slotName, UseableEntry entry)
|
||||
{
|
||||
foreach (var slot in _slots)
|
||||
{
|
||||
if (slot.SlotName == slotName)
|
||||
{
|
||||
slot.SetEntry(entry);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public QuickSlot GetSlot(string slotName)
|
||||
{
|
||||
foreach (var slot in _slots)
|
||||
if (slot.SlotName == slotName) return slot;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user