Files
Cielonos/Packages/com.opsive.behaviordesigner/Runtime/Tasks/Actions/Variables/SetVector2Variable.cs
SoulliesOfficial 9a9e48f8a5
2026-06-27 12:52:03 -04:00

43 lines
1.4 KiB
C#

#if GRAPH_DESIGNER
/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.BehaviorDesigner.Runtime.Tasks.Actions.Variables
{
using Opsive.GraphDesigner.Runtime;
using Opsive.GraphDesigner.Runtime.Variables;
using UnityEngine;
[Opsive.Shared.Utility.Description("Sets the value of a Vector2 SharedVariable by name.")]
[Shared.Utility.Category("Variables")]
public class SetVector2Variable : SetVariableBase
{
[Tooltip("The name of the Vector2 SharedVariable.")]
[SerializeField] protected SharedVariable<string> m_VariableName;
[Tooltip("The Vector2 value to set.")]
[SerializeField] protected SharedVariable<Vector2> m_Value;
/// <summary>
/// Executes the task.
/// </summary>
/// <returns>The execution status of the task.</returns>
public override TaskStatus OnUpdate()
{
SetVariableValue(m_VariableName, m_Value.Value);
return TaskStatus.Success;
}
/// <summary>
/// Resets the task values back to their default.
/// </summary>
public override void Reset()
{
base.Reset();
m_VariableName = "";
m_Value = Vector2.zero;
}
}
}
#endif