50 lines
1.0 KiB
C#
50 lines
1.0 KiB
C#
// (c) Copyright HutongGames, LLC 2010-2016. All rights reserved.
|
|
|
|
namespace HutongGames.PlayMaker.Actions
|
|
{
|
|
[ActionCategory(ActionCategory.Vector2)]
|
|
[Tooltip("Sets the value of a Vector2 Variable.")]
|
|
public class SetVector2Value : FsmStateAction
|
|
{
|
|
[RequiredField]
|
|
[UIHint(UIHint.Variable)]
|
|
[Tooltip("The vector2 target")]
|
|
public FsmVector2 vector2Variable;
|
|
|
|
[RequiredField]
|
|
[Tooltip("The vector2 source")]
|
|
public FsmVector2 vector2Value;
|
|
|
|
[Tooltip("Repeat every frame.")]
|
|
public bool everyFrame;
|
|
|
|
public override void Reset()
|
|
{
|
|
vector2Variable = null;
|
|
vector2Value = null;
|
|
everyFrame = false;
|
|
}
|
|
|
|
public override void OnEnter()
|
|
{
|
|
vector2Variable.Value = vector2Value.Value;
|
|
|
|
if (!everyFrame)
|
|
Finish();
|
|
}
|
|
|
|
public override void OnUpdate()
|
|
{
|
|
vector2Variable.Value = vector2Value.Value;
|
|
}
|
|
|
|
#if UNITY_EDITOR
|
|
public override string AutoName()
|
|
{
|
|
return ActionHelpers.AutoNameSetVar("Vector2", vector2Variable, vector2Value);
|
|
}
|
|
#endif
|
|
}
|
|
}
|
|
|