2026-02-13 09:22:11 -05:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Cielonos.Core.Interaction;
|
2026-01-03 18:19:39 -05:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
2026-02-13 09:22:11 -05:00
|
|
|
namespace Cielonos.MainGame.Characters
|
2026-01-03 18:19:39 -05:00
|
|
|
{
|
2026-02-13 09:22:11 -05:00
|
|
|
public class PlayerInteractionSubcontroller : SubcontrollerBase<Player>
|
2026-01-03 18:19:39 -05:00
|
|
|
{
|
2026-02-13 09:22:11 -05:00
|
|
|
public Player player => owner;
|
|
|
|
|
public List<InteractionChoice> currentChoices = new List<InteractionChoice>();
|
2026-01-03 18:19:39 -05:00
|
|
|
|
2026-02-13 09:22:11 -05:00
|
|
|
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();
|
|
|
|
|
}
|
2026-01-03 18:19:39 -05:00
|
|
|
}
|
2026-02-13 09:22:11 -05:00
|
|
|
}
|