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

40 lines
854 B
C#

// (c) Copyright HutongGames, LLC 2010-2016. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Vector2)]
[Tooltip("Multiplies a Vector2 variable by Time.deltaTime. Useful for frame rate independent motion.")]
public class Vector2PerSecond : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
[Tooltip("The Vector2")]
public FsmVector2 vector2Variable;
[Tooltip("Repeat every frame")]
public bool everyFrame;
public override void Reset()
{
vector2Variable = null;
everyFrame = true;
}
public override void OnEnter()
{
vector2Variable.Value = vector2Variable.Value * Time.deltaTime;
if (!everyFrame)
Finish();
}
public override void OnUpdate()
{
vector2Variable.Value = vector2Variable.Value * Time.deltaTime;
}
}
}