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,61 @@
#if GRAPH_DESIGNER
/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.BehaviorDesigner.Runtime.Tasks.Conditionals.Physics
{
using Opsive.GraphDesigner.Runtime;
using Opsive.GraphDesigner.Runtime.Variables;
using UnityEngine;
[Opsive.Shared.Utility.Description("Returns success when a collision starts. This task will only receive the physics callback if it is being reevaluated (with a conditional abort or under a parallel task).")]
[Shared.Utility.Category("Physics")]
public class HasEnteredCollision : Conditional
{
[Tooltip("The tag of the GameObject that the collision should be checked against.")]
[SerializeField] protected SharedVariable<string> m_Tag;
[Tooltip("The collided GameObject.")]
[SerializeField] protected SharedVariable<GameObject> m_StoredCollisionGameObject;
protected override bool ReceiveCollisionEnterCallback => true;
private bool m_EnteredCollision;
/// <summary>
/// Returns true when the agent has caused a collision.
/// </summary>
/// <returns>True when the agent has caused a collision.</returns>
public override TaskStatus OnUpdate()
{
return m_EnteredCollision ? TaskStatus.Success : TaskStatus.Failure;
}
/// <summary>
/// The task has ended.
/// </summary>
public override void OnEnd()
{
base.OnEnd();
m_EnteredCollision = false;
}
/// <summary>
/// The agent has caused a collision.
/// </summary>
/// <param name="collision">The collision that caused the event.</param>
protected override void OnCollisionEnter(Collision collision)
{
if (!string.IsNullOrEmpty(m_Tag.Value) && !collision.gameObject.CompareTag(m_Tag.Value)) {
return;
}
if (m_StoredCollisionGameObject != null && m_StoredCollisionGameObject.IsShared) { m_StoredCollisionGameObject.Value = collision.gameObject; }
m_EnteredCollision = true;
}
}
}
#endif

View File

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

View File

@@ -0,0 +1,61 @@
#if GRAPH_DESIGNER
/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.BehaviorDesigner.Runtime.Tasks.Conditionals.Physics
{
using Opsive.GraphDesigner.Runtime;
using Opsive.GraphDesigner.Runtime.Variables;
using UnityEngine;
[Opsive.Shared.Utility.Description("Returns success when a 2D collision starts. This task will only receive the physics callback if it is being reevaluated (with a conditional abort or under a parallel task).")]
[Shared.Utility.Category("Physics")]
public class HasEnteredCollision2D : Conditional
{
[Tooltip("The tag of the GameObject that the collision should be checked against.")]
[SerializeField] protected SharedVariable<string> m_Tag;
[Tooltip("The collided GameObject.")]
[SerializeField] protected SharedVariable<GameObject> m_StoredCollisionGameObject;
protected override bool ReceiveCollisionEnterCallback => true;
private bool m_EnteredCollision;
/// <summary>
/// Returns true when the agent has caused a collision.
/// </summary>
/// <returns>True when the agent has caused a collision.</returns>
public override TaskStatus OnUpdate()
{
return m_EnteredCollision ? TaskStatus.Success : TaskStatus.Failure;
}
/// <summary>
/// The task has ended.
/// </summary>
public override void OnEnd()
{
base.OnEnd();
m_EnteredCollision = false;
}
/// <summary>
/// The agent has caused a collision.
/// </summary>
/// <param name="collision">The collision that caused the event.</param>
protected override void OnCollisionEnter2D(Collision2D collision)
{
if (!string.IsNullOrEmpty(m_Tag.Value) && !collision.gameObject.CompareTag(m_Tag.Value)) {
return;
}
if (m_StoredCollisionGameObject != null && m_StoredCollisionGameObject.IsShared) { m_StoredCollisionGameObject.Value = collision.gameObject; }
m_EnteredCollision = true;
}
}
}
#endif

View File

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

View File

@@ -0,0 +1,60 @@
#if GRAPH_DESIGNER
/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.BehaviorDesigner.Runtime.Tasks.Conditionals.Physics
{
using Opsive.GraphDesigner.Runtime.Variables;
using UnityEngine;
[Opsive.Shared.Utility.Description("Returns success when an object enters the trigger. This task will only receive the physics callback if it is being reevaluated (with a conditional abort or under a parallel task).")]
[Shared.Utility.Category("Physics")]
public class HasEnteredTrigger : Conditional
{
[Tooltip("The tag of the GameObject that the trigger should be checked against.")]
[SerializeField] protected SharedVariable<string> m_Tag;
[Tooltip("The entered trigger.")]
[SerializeField] protected SharedVariable<Collider> m_StoredOtherCollider;
protected override bool ReceiveTriggerEnterCallback => true;
private bool m_EnteredTrigger;
/// <summary>
/// Returns true when the agent has entered a trigger.
/// </summary>
/// <returns>True when the agent has entered a trigger.</returns>
public override TaskStatus OnUpdate()
{
return m_EnteredTrigger ? TaskStatus.Success : TaskStatus.Failure;
}
/// <summary>
/// The task has ended.
/// </summary>
public override void OnEnd()
{
base.OnEnd();
m_EnteredTrigger = false;
}
/// <summary>
/// The agent has entered a trigger.
/// </summary>
/// <param name="other">The trigger that the agent entered.</param>
protected override void OnTriggerEnter(Collider other)
{
if (!string.IsNullOrEmpty(m_Tag.Value) && !other.gameObject.CompareTag(m_Tag.Value)) {
return;
}
if (m_StoredOtherCollider != null && m_StoredOtherCollider.IsShared) { m_StoredOtherCollider.Value = other; }
m_EnteredTrigger = true;
}
}
}
#endif

View File

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

View File

@@ -0,0 +1,61 @@
#if GRAPH_DESIGNER
/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.BehaviorDesigner.Runtime.Tasks.Conditionals.Physics
{
using Opsive.GraphDesigner.Runtime;
using Opsive.GraphDesigner.Runtime.Variables;
using UnityEngine;
[Opsive.Shared.Utility.Description("Returns success when an object enters the 2D trigger. This task will only receive the physics callback if it is being reevaluated (with a conditional abort or under a parallel task).")]
[Shared.Utility.Category("Physics")]
public class HasEnteredTrigger2D : Conditional
{
[Tooltip("The tag of the GameObject that the trigger should be checked against.")]
[SerializeField] protected SharedVariable<string> m_Tag;
[Tooltip("The entered trigger.")]
[SerializeField] protected SharedVariable<Collider2D> m_StoredOtherCollider;
protected override bool ReceiveTriggerEnter2DCallback => true;
private bool m_EnteredTrigger;
/// <summary>
/// Returns true when the agent has entered a trigger.
/// </summary>
/// <returns>True when the agent has entered a trigger.</returns>
public override TaskStatus OnUpdate()
{
return m_EnteredTrigger ? TaskStatus.Success : TaskStatus.Failure;
}
/// <summary>
/// The task has ended.
/// </summary>
public override void OnEnd()
{
base.OnEnd();
m_EnteredTrigger = false;
}
/// <summary>
/// The agent has entered a trigger.
/// </summary>
/// <param name="other">The trigger that the agent entered.</param>
protected override void OnTriggerEnter2D(Collider2D other)
{
if (!string.IsNullOrEmpty(m_Tag.Value) && !other.gameObject.CompareTag(m_Tag.Value)) {
return;
}
if (m_StoredOtherCollider != null && m_StoredOtherCollider.IsShared) { m_StoredOtherCollider.Value = other; }
m_EnteredTrigger = true;
}
}
}
#endif

View File

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

View File

@@ -0,0 +1,61 @@
#if GRAPH_DESIGNER
/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.BehaviorDesigner.Runtime.Tasks.Conditionals.Physics
{
using Opsive.GraphDesigner.Runtime;
using Opsive.GraphDesigner.Runtime.Variables;
using UnityEngine;
[Opsive.Shared.Utility.Description("Returns success when a collision ends. This task will only receive the physics callback if it is being reevaluated (with a conditional abort or under a parallel task).")]
[Shared.Utility.Category("Physics")]
public class HasExitedCollision : Conditional
{
[Tooltip("The tag of the GameObject that the collision should be checked against.")]
[SerializeField] protected SharedVariable<string> m_Tag;
[Tooltip("The collided GameObject.")]
[SerializeField] protected SharedVariable<GameObject> m_StoredCollisionGameObject;
protected override bool ReceiveCollisionExitCallback => true;
private bool m_ExitedCollision;
/// <summary>
/// Returns true when the agent has left a collision.
/// </summary>
/// <returns>True when the agent has left a collision.</returns>
public override TaskStatus OnUpdate()
{
return m_ExitedCollision ? TaskStatus.Success : TaskStatus.Failure;
}
/// <summary>
/// The task has ended.
/// </summary>
public override void OnEnd()
{
base.OnEnd();
m_ExitedCollision = false;
}
/// <summary>
/// The agent has left a collision.
/// </summary>
/// <param name="collision">The collision that caused the event.</param>
protected override void OnCollisionExit(Collision collision)
{
if (!string.IsNullOrEmpty(m_Tag.Value) && !collision.gameObject.CompareTag(m_Tag.Value)) {
return;
}
if (m_StoredCollisionGameObject != null && m_StoredCollisionGameObject.IsShared) { m_StoredCollisionGameObject.Value = collision.gameObject; }
m_ExitedCollision = true;
}
}
}
#endif

View File

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

View File

@@ -0,0 +1,61 @@
#if GRAPH_DESIGNER
/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.BehaviorDesigner.Runtime.Tasks.Conditionals.Physics
{
using Opsive.GraphDesigner.Runtime;
using Opsive.GraphDesigner.Runtime.Variables;
using UnityEngine;
[Opsive.Shared.Utility.Description("Returns success when a 2D collision ends. This task will only receive the physics callback if it is being reevaluated (with a conditional abort or under a parallel task).")]
[Shared.Utility.Category("Physics")]
public class HasExitedCollision2D : Conditional
{
[Tooltip("The tag of the GameObject that the collision should be checked against.")]
[SerializeField] protected SharedVariable<string> m_Tag;
[Tooltip("The collided GameObject.")]
[SerializeField] protected SharedVariable<GameObject> m_StoredCollisionGameObject;
protected override bool ReceiveCollisionExit2DCallback => true;
private bool m_ExitedCollision;
/// <summary>
/// Returns true when the agent has left a collision.
/// </summary>
/// <returns>True when the agent has left a collision.</returns>
public override TaskStatus OnUpdate()
{
return m_ExitedCollision ? TaskStatus.Success : TaskStatus.Failure;
}
/// <summary>
/// The task has ended.
/// </summary>
public override void OnEnd()
{
base.OnEnd();
m_ExitedCollision = false;
}
/// <summary>
/// The agent has left a collision.
/// </summary>
/// <param name="collision">The collision that caused the event.</param>
protected override void OnCollisionExit2D(Collision2D collision)
{
if (!string.IsNullOrEmpty(m_Tag.Value) && !collision.gameObject.CompareTag(m_Tag.Value)) {
return;
}
if (m_StoredCollisionGameObject != null && m_StoredCollisionGameObject.IsShared) { m_StoredCollisionGameObject.Value = collision.gameObject; }
m_ExitedCollision = true;
}
}
}
#endif

View File

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

View File

@@ -0,0 +1,61 @@
#if GRAPH_DESIGNER
/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.BehaviorDesigner.Runtime.Tasks.Conditionals.Physics
{
using Opsive.GraphDesigner.Runtime;
using Opsive.GraphDesigner.Runtime.Variables;
using UnityEngine;
[Opsive.Shared.Utility.Description("Returns success when an object exits the trigger. This task will only receive the physics callback if it is being reevaluated (with a conditional abort or under a parallel task).")]
[Shared.Utility.Category("Physics")]
public class HasExitedTrigger : Conditional
{
[Tooltip("The tag of the GameObject that the trigger should be checked against.")]
[SerializeField] protected SharedVariable<string> m_Tag;
[Tooltip("The exited trigger.")]
[SerializeField] protected SharedVariable<Collider> m_StoredOtherCollider;
protected override bool ReceiveTriggerExitCallback => true;
private bool m_ExitedTrigger;
/// <summary>
/// Returns true when the agent has exited a trigger.
/// </summary>
/// <returns>True when the agent has exited a trigger.</returns>
public override TaskStatus OnUpdate()
{
return m_ExitedTrigger ? TaskStatus.Success : TaskStatus.Failure;
}
/// <summary>
/// The task has ended.
/// </summary>
public override void OnEnd()
{
base.OnEnd();
m_ExitedTrigger = false;
}
/// <summary>
/// The agent has exited a trigger.
/// </summary>
/// <param name="other">The trigger that the agent exited.</param>
protected override void OnTriggerExit(Collider other)
{
if (!string.IsNullOrEmpty(m_Tag.Value) && !other.gameObject.CompareTag(m_Tag.Value)) {
return;
}
if (m_StoredOtherCollider != null && m_StoredOtherCollider.IsShared) { m_StoredOtherCollider.Value = other; }
m_ExitedTrigger = true;
}
}
}
#endif

View File

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

View File

@@ -0,0 +1,61 @@
#if GRAPH_DESIGNER
/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.BehaviorDesigner.Runtime.Tasks.Conditionals.Physics
{
using Opsive.GraphDesigner.Runtime;
using Opsive.GraphDesigner.Runtime.Variables;
using UnityEngine;
[Opsive.Shared.Utility.Description("Returns success when an object exits the 2D trigger. This task will only receive the physics callback if it is being reevaluated (with a conditional abort or under a parallel task).")]
[Shared.Utility.Category("Physics")]
public class HasExitedTrigger2D : Conditional
{
[Tooltip("The tag of the GameObject that the trigger should be checked against.")]
[SerializeField] protected SharedVariable<string> m_Tag;
[Tooltip("The exited trigger.")]
[SerializeField] protected SharedVariable<Collider2D> m_StoredOtherCollider;
protected override bool ReceiveTriggerExit2DCallback => true;
private bool m_ExitedTrigger;
/// <summary>
/// Returns true when the agent has exited a trigger.
/// </summary>
/// <returns>True when the agent has exited a trigger.</returns>
public override TaskStatus OnUpdate()
{
return m_ExitedTrigger ? TaskStatus.Success : TaskStatus.Failure;
}
/// <summary>
/// The task has ended.
/// </summary>
public override void OnEnd()
{
base.OnEnd();
m_ExitedTrigger = false;
}
/// <summary>
/// The agent has exited a trigger.
/// </summary>
/// <param name="other">The trigger that the agent exited.</param>
protected override void OnTriggerExit2D(Collider2D other)
{
if (!string.IsNullOrEmpty(m_Tag.Value) && !other.gameObject.CompareTag(m_Tag.Value)) {
return;
}
if (m_StoredOtherCollider != null && m_StoredOtherCollider.IsShared) { m_StoredOtherCollider.Value = other; }
m_ExitedTrigger = true;
}
}
}
#endif

View File

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