Scriptum/Assets/Scripts/REFACTORING/Models/Dialogue/DialogueData.cs
2023-01-02 00:22:39 +01:00

58 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
[Serializable]
public abstract class DialogueData<T> : IModelMapper<T>
{
[SerializeField]
public int CurrentStep;
[SerializeField]
public List<DialogueStepData> DialogueStepModelDataList = new List<DialogueStepData>();
#region NotImplemented
/*
* we dont want to map it here, we will mark fields in NpcDialogfeManager after each loading and fetching dialogue
*/
public T MapDataToObject(string prefarbAssetName)
{
throw new NotImplementedException();
}
public T MapDataToObject()
{
throw new NotImplementedException();
}
#endregion
}
[Serializable]
public class DialogueData : DialogueData<Dialogue>
{
/// <summary>
/// build Data model based on Object
/// </summary>
/// <param name="dialogue"></param>
public DialogueData(Dialogue dialogue)
{
CurrentStep = dialogue.CurrentStep;
DialogueStepModelDataList.Clear();
foreach(DialogueStepModel dialogueStepModelData in dialogue.DialogueSteps)
{
/*
* pass WasDisplayed value from model to data representative class
*/
DialogueStepModelDataList.Add(new DialogueStepData(dialogueStepModelData.WasDisplayed));
}
}
}