35 lines
718 B
C#
35 lines
718 B
C#
using DragonLi.EventFlow;
|
|
using UnityEngine;
|
|
|
|
namespace DragonLi.Examples
|
|
{
|
|
public class RandomInt : ConditionUnit
|
|
{
|
|
private int min;
|
|
private int max;
|
|
|
|
[AsInput("Min", ParameterTpyes.Int)]
|
|
public void GetMin(object min)
|
|
{
|
|
this.min = (int)min;
|
|
}
|
|
|
|
[AsInput("Max", ParameterTpyes.Int)]
|
|
public void GetMax(object max)
|
|
{
|
|
this.max = (int)max;
|
|
}
|
|
|
|
/// <summary>
|
|
/// This will be called when some node wants the result
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected override int OnCondition()
|
|
{
|
|
return Random.Range(min, max + 1);
|
|
}
|
|
}
|
|
}
|
|
|
|
|