Files
XMen/Assets/Plugins/DragonLi/Examples/Eventflow/RandomInt.cs
2025-07-02 17:56:55 +08:00

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);
}
}
}