Files
Cielonos/Packages/com.opsive.behaviordesigner/Runtime/Tasks/Actions/Variables/SetBoolVariable.cs

43 lines
1.4 KiB
C#
Raw Normal View History

2025-11-25 08:19:33 -05:00
#if GRAPH_DESIGNER
/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
2026-05-10 11:47:55 -04:00
namespace Opsive.BehaviorDesigner.Runtime.Tasks.Actions.Variables
2025-11-25 08:19:33 -05:00
{
using Opsive.GraphDesigner.Runtime;
using Opsive.GraphDesigner.Runtime.Variables;
using UnityEngine;
2026-06-27 12:52:03 -04:00
[Opsive.Shared.Utility.Description("Sets the value of a bool SharedVariable by name.")]
2026-05-10 11:47:55 -04:00
[Shared.Utility.Category("Variables")]
2026-06-27 12:52:03 -04:00
public class SetBoolVariable : SetVariableBase
2025-11-25 08:19:33 -05:00
{
2026-06-27 12:52:03 -04:00
[Tooltip("The name of the bool SharedVariable.")]
[SerializeField] protected SharedVariable<string> m_VariableName;
2025-11-25 08:19:33 -05:00
[Tooltip("The bool value to set.")]
[SerializeField] protected SharedVariable<bool> m_Value;
/// <summary>
/// Executes the task.
/// </summary>
/// <returns>The execution status of the task.</returns>
public override TaskStatus OnUpdate()
{
2026-06-27 12:52:03 -04:00
SetVariableValue(m_VariableName, m_Value.Value);
2025-11-25 08:19:33 -05:00
return TaskStatus.Success;
}
2026-06-27 12:52:03 -04:00
/// <summary>
/// Resets the task values back to their default.
/// </summary>
public override void Reset()
{
base.Reset();
m_VariableName = "";
m_Value = false;
}
2025-11-25 08:19:33 -05:00
}
}
#endif