Files
2024-11-20 15:21:28 +01:00

45 lines
935 B
C#

// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Math)]
[Tooltip("Divides one Float by another.")]
public class FloatDivide : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
[Tooltip("The float variable to divide.")]
public FsmFloat floatVariable;
[RequiredField]
[Tooltip("Divide the float variable by this value.")]
public FsmFloat divideBy;
[Tooltip("Repeat every frame. Useful if the variables are changing.")]
public bool everyFrame;
public override void Reset()
{
floatVariable = null;
divideBy = null;
everyFrame = false;
}
public override void OnEnter()
{
floatVariable.Value /= divideBy.Value;
if (!everyFrame)
{
Finish();
}
}
public override void OnUpdate()
{
floatVariable.Value /= divideBy.Value;
}
}
}