arthurdiniz0_outer-math/OuterMath Unity Project/Assets/PlayMaker/Actions/Math/SetBoolValue.cs
// (c) Copyright HutongGames. All rights reserved.

namespace HutongGames.PlayMaker.Actions
{
	[ActionCategory(ActionCategory.Math)]
	[Tooltip("Sets the value of a Bool Variable.")]
	public class SetBoolValue : FsmStateAction
	{
		[RequiredField]
		[UIHint(UIHint.Variable)]
        [Tooltip("Bool Variable to set.")]
		public FsmBool boolVariable;

		[RequiredField]
        [Tooltip("Value to set it to: Check to set to True, Uncheck to set to False.")]
		public FsmBool boolValue;

	    [Tooltip("Repeat every frame.")]
		public bool everyFrame;

		public override void Reset()
		{
			boolVariable = null;
			boolValue = null;
			everyFrame = false;
		}

		public override void OnEnter()
		{
			boolVariable.Value = boolValue.Value;
			
			if (!everyFrame)
				Finish();		
		}

		public override void OnUpdate()
		{
			boolVariable.Value = boolValue.Value;
		}

#if UNITY_EDITOR
	    public override string AutoName()
	    {
	        return ActionHelpers.AutoNameSetVar("SetBool", boolVariable, boolValue);
	    }
#endif
	}
}