You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
902 B
48 lines
902 B
10 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
10 years ago
|
namespace Fungus.Script
|
||
10 years ago
|
{
|
||
|
|
||
10 years ago
|
public class AddOption : FungusCommand
|
||
10 years ago
|
{
|
||
|
public enum Condition
|
||
|
{
|
||
|
AlwaysShow,
|
||
|
HideOnVisited,
|
||
|
ShowOnBoolean,
|
||
|
HideOnBoolean
|
||
|
}
|
||
|
|
||
|
public string text;
|
||
|
public Sequence sequence;
|
||
|
public Condition condition;
|
||
|
public string booleanVariableKey;
|
||
|
|
||
|
public override void OnEnter()
|
||
|
{
|
||
|
Dialog dialog = Game.GetInstance().dialog;
|
||
|
if (dialog != null &&
|
||
10 years ago
|
sequence != null &&
|
||
|
!(condition == Condition.HideOnVisited && sequence.GetExecutionCount() > 0))
|
||
10 years ago
|
{
|
||
|
dialog.AddOption(text, () => {
|
||
|
Stop();
|
||
|
parentFungusScript.ExecuteSequence(sequence);
|
||
|
});
|
||
|
}
|
||
|
Continue();
|
||
|
}
|
||
|
|
||
|
public override void GetConnectedSequences(ref List<Sequence> connectedSequences)
|
||
|
{
|
||
|
if (sequence != null)
|
||
|
{
|
||
|
connectedSequences.Add(sequence);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|