73 lines
1.7 KiB
C#
73 lines
1.7 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
[Serializable]
|
|||
|
[CreateAssetMenu(fileName = "New Mission Dialogue", menuName = "Dialogue/New Mission Dialogue")]
|
|||
|
|
|||
|
public class MissionDialogue : Dialogue
|
|||
|
{
|
|||
|
[NonSerialized]
|
|||
|
private MissionStepModel Parent;
|
|||
|
|
|||
|
|
|||
|
public void BindParent(MissionStepModel parent)
|
|||
|
{
|
|||
|
Parent = parent;
|
|||
|
}
|
|||
|
|
|||
|
#region Mission API for button actions
|
|||
|
/// <summary>
|
|||
|
/// Api for mission allowing to bind action to button
|
|||
|
/// </summary>
|
|||
|
public void AcceptMission()
|
|||
|
{
|
|||
|
Parent.GetOriginMission().Accept();
|
|||
|
|
|||
|
// show next panel if exists
|
|||
|
ShowNextPanel();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Api for mission allowing to bind action to button
|
|||
|
/// </summary>
|
|||
|
public void RejectMission()
|
|||
|
{
|
|||
|
Parent.GetOriginMission().Reject();
|
|||
|
|
|||
|
Parent.Status = MissionStepStatusEnum.Finished;
|
|||
|
|
|||
|
GetCurrentStep().DialogueController.CloseCurrentPanel();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Function to bind checking condition method from associated Mission (parent)
|
|||
|
/// to specifi button in dialogue step structure
|
|||
|
/// </summary>
|
|||
|
public void HandleCondition()
|
|||
|
{
|
|||
|
Debug.Log("Handle Conditoion");
|
|||
|
var result = Parent.HanldeMissionStepCondition();
|
|||
|
|
|||
|
Debug.Log(CurrentStep);
|
|||
|
if (result) GoToNextSentence();
|
|||
|
else BreakDialogueStep();
|
|||
|
}
|
|||
|
|
|||
|
public void GiveReward()
|
|||
|
{
|
|||
|
Debug.Log("Give reward");
|
|||
|
Parent.GetOriginMission().GiveReward();
|
|||
|
}
|
|||
|
|
|||
|
public void FinishMission()
|
|||
|
{
|
|||
|
Parent.GetOriginMission().FinishMission();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|