This commit is contained in:
2026-05-27 16:48:22 +08:00
parent 0082c0b727
commit e81e4547e7
535 changed files with 35957 additions and 10 deletions

View File

@@ -0,0 +1,36 @@
#if GRAPH_DESIGNER
/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.BehaviorDesigner.Runtime.Tasks.Actions.UnityObjects
{
using Opsive.GraphDesigner.Runtime;
using Opsive.GraphDesigner.Runtime.Variables;
using UnityEngine;
[Opsive.Shared.Utility.Description("Enables or disables the specified MonoBehaviour.")]
[Shared.Utility.Category("Unity")]
public class SetEnabled : Action
{
[Tooltip("Should the MonoBehaviour be enabled?")]
[SerializeField] protected SharedVariable<bool> m_Enable;
[Tooltip("The MonoBehaviour that should be enabled or disabled.")]
[SerializeField] protected SharedVariable<MonoBehaviour> m_MonoBehaviour;
/// <summary>
/// Executes the task.
/// </summary>
/// <returns>The execution status of the task.</returns>
public override TaskStatus OnUpdate()
{
if (m_MonoBehaviour.Value == null) {
return TaskStatus.Failure;
}
m_MonoBehaviour.Value.enabled = m_Enable.Value;
return TaskStatus.Success;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8f30ae346f704e446942d6cdb1c4adfa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,33 @@
#if GRAPH_DESIGNER
/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.BehaviorDesigner.Runtime.Tasks.Actions.UnityObjects
{
using Opsive.GraphDesigner.Runtime;
using Opsive.GraphDesigner.Runtime.Variables;
using UnityEngine;
[Opsive.Shared.Utility.Description("Set the GameObject value.")]
[Shared.Utility.Category("Unity")]
public class SetGameObject : TargetGameObjectAction
{
[Tooltip("The variable that should be set.")]
[RequireShared] [SerializeField] protected SharedVariable<GameObject> m_StoreResult;
/// <summary>
/// Executes the task.
/// </summary>
/// <returns>The execution status of the task.</returns>
public override TaskStatus OnUpdate()
{
InitializeTarget();
m_StoreResult.Value = m_ResolvedGameObject;
return TaskStatus.Success;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: acfe874544935e64f80eeb34681141c1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,58 @@
#if GRAPH_DESIGNER
/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.BehaviorDesigner.Runtime.Tasks.Actions.UnityObjects
{
using Opsive.GraphDesigner.Runtime;
using Opsive.GraphDesigner.Runtime.Variables;
using UnityEngine;
[Opsive.Shared.Utility.Description("Returns success as soon as the current Animator state ends.")]
[Shared.Utility.Category("Unity")]
public class WaitForAnimatorState : TargetGameObjectAction
{
[Tooltip("The layer to wait for the state on.")]
public SharedVariable<int> m_Layer;
private Animator m_Animator;
private int m_StateHash;
/// <summary>
/// Initializes the default values.
/// </summary>
public override void OnAwake()
{
base.OnAwake();
m_Animator = gameObject.GetComponent<Animator>();
}
/// <summary>
/// Caches the Animator state.
/// </summary>
public override void OnStart()
{
m_StateHash = (m_Animator.IsInTransition(m_Layer.Value) ? m_Animator.GetNextAnimatorStateInfo(m_Layer.Value) : m_Animator.GetCurrentAnimatorStateInfo(m_Layer.Value)).fullPathHash;
}
/// <summary>
/// Executes the task.
/// </summary>
/// <returns>The execution status of the task.</returns>
public override TaskStatus OnUpdate()
{
if (m_Animator.IsInTransition(m_Layer.Value)) {
return TaskStatus.Running;
}
var currentState = m_Animator.GetCurrentAnimatorStateInfo(m_Layer.Value).fullPathHash;
if (currentState != m_StateHash) {
return TaskStatus.Success;
}
return TaskStatus.Running;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7f6c915175357ab449604315406c51bb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: