unity-roject-test/Assets/Scripts/Rokojori/Dialog/PlayerChoice.cs

29 lines
600 B
C#
Raw Normal View History

2026-09-25 20:32:02 +00:00
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
namespace Rokojori
{
[CreateAssetMenu( menuName = "Rokojori/Dialog/Player Choice" )]
public class PlayerChoice : DialogBlock
{
public Locale choiceLine = null;
public List<DialogOption> options = new List<DialogOption>();
public override async Task<DialogBlock> Run( IDialogDisplay display )
{
var answer = await display.Show( this );
var option = options[ answer.selectedOptionIndex ];
if ( option.action != null )
{
option.action.Execute();
}
return option.next;
}
}
}