using EasyTalk.Nodes.Core;
using System;
namespace EasyTalk.Nodes.Flow
{
///
/// A node which allows a random dialogue flow path to be chosen when reached.
///
[Serializable]
public class RandomNode : ListNode, DialogueFlowNode
{
///
/// Creates a new RandomNode.
///
public RandomNode()
{
this.name = "RAND";
this.nodeType = NodeType.RANDOM;
}
///
public NodeConnection GetFlowInput()
{
return Inputs[0];
}
///
public NodeConnection GetFlowOutput()
{
if(Outputs.Count > 0)
{
int index = UnityEngine.Random.Range(0,Outputs.Count);
return Outputs[index];
}
return null;
}
}
///
/// A dialogue flow path item for a random node.
///
[Serializable]
public class RandomItem : ListItem
{
}
}