// (c) Copyright HutongGames, LLC 2010-2016. All rights reserved. namespace HutongGames.PlayMaker.Actions { [ActionCategory(ActionCategory.Vector2)] [Tooltip("Reverses the direction of a Vector2 Variable. Same as multiplying by -1.")] public class Vector2Invert : FsmStateAction { [RequiredField] [UIHint(UIHint.Variable)] [Tooltip("The vector to invert")] public FsmVector2 vector2Variable; [Tooltip("Repeat every frame")] public bool everyFrame; public override void Reset() { vector2Variable = null; everyFrame = false; } public override void OnEnter() { vector2Variable.Value = vector2Variable.Value * -1; if (!everyFrame) Finish(); } public override void OnUpdate() { vector2Variable.Value = vector2Variable.Value * -1; } } }