Files
beyond/Assets/ThirdParty/PlayMaker/Actions/Math/RandomFloat.cs
2024-11-20 15:21:28 +01:00

33 lines
655 B
C#

// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Math)]
[Tooltip("Sets a Float Variable to a random value between Min/Max.")]
public class RandomFloat : FsmStateAction
{
[RequiredField]
public FsmFloat min;
[RequiredField]
public FsmFloat max;
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmFloat storeResult;
public override void Reset()
{
min = 0f;
max = 1f;
storeResult = null;
}
public override void OnEnter()
{
storeResult.Value = Random.Range(min.Value, max.Value);
Finish();
}
}
}