using System; using System.Collections.Generic; using Cielonos.Core.Interaction; using UnityEngine; namespace Cielonos.MainGame.Characters { public class PlayerInteractionSubcontroller : SubcontrollerBase { public Player player => owner; public List currentChoices = new List(); public override void Initialize() { base.Initialize(); player.operationSc.OnInteract += () => ExecuteChoice(0); } public void ExecuteChoice(int index = 0) { if (index < 0 || index >= currentChoices.Count) { Debug.LogWarning("Invalid interaction choice index."); return; } var choice = currentChoices[index]; choice.action?.Invoke(); } } }