Files
Cielonos/Packages/com.opsive.behaviordesigner/Runtime/Tasks/Actions/Variables/SetIntVariable.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 an int SharedVariable by name.")]
[Shared.Utility.Category("Variables")]
public class SetIntVariable : SetVariableBase
{
[Tooltip("The name of the int SharedVariable.")]
[SerializeField] protected SharedVariable<string> m_VariableName;
[Tooltip("The int value to set.")]
[SerializeField] protected SharedVariable<int> 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 = 0;
}
}
}
#endif