Scriptum/Assets/Scripts/Domain/Dialogue/Model/DialogueStepModel.cs
2022-10-16 19:40:44 +02:00

55 lines
1.5 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
// change to "mission step" model in future
[Serializable]
public class DialogueStepModel
{
[SerializeField] // this flag tell whatewer dialoge ware already display to user
public bool WasDisplayed = false;
[SerializeField] // list to map to queue in DialogueController
public List<DialogueModel> ListOfSentences = new List<DialogueModel>();
[SerializeField]
public List<GameObject> Rewards;
[SerializeField]
public UnityEvent EndOfDialogueStepAction = new UnityEvent();
// for displaying set of sentences in one display
public DialogueController DialogueController { get; protected set; }
public DialogueStepModel() { }
public DialogueStepModel(DialogueController _dialogueController)
{
DialogueController = _dialogueController;
}
/// <summary>
/// Just convert list to queue structure :D
/// </summary>
public virtual void Build()
{
// 1. Clear previous setups
// 2. Map first structur into second
DialogueController = new DialogueController();
foreach (DialogueModel DialogueModel in ListOfSentences)
{
// Pass data to builded panel (name, sentence, buttons)
DialogueController.AddSentence(DialogueModel);
}
// 3. Bind finishing action
DialogueController.SetActionAfterDialogueEnds(EndOfDialogueStepAction);
}
}