diff options
Diffstat (limited to 'Client/Assets/Behavior Designer/Runtime/Conditionals/Physics')
16 files changed, 391 insertions, 0 deletions
diff --git a/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredCollision.cs b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredCollision.cs new file mode 100644 index 00000000..480e4093 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredCollision.cs @@ -0,0 +1,41 @@ +using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks
+{
+ [TaskDescription("Returns success when a collision starts.")]
+ [TaskCategory("Physics")]
+ [HelpURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=110")]
+ public class HasEnteredCollision : Conditional
+ {
+ [Tooltip("The tag of the GameObject to check for a collision against")]
+ public SharedString tag = "";
+ [Tooltip("The object that started the collision")]
+ public SharedGameObject collidedGameObject;
+
+ private bool enteredCollision = false;
+
+ public override TaskStatus OnUpdate()
+ {
+ return enteredCollision ? TaskStatus.Success : TaskStatus.Failure;
+ }
+
+ public override void OnEnd()
+ {
+ enteredCollision = false;
+ }
+
+ public override void OnCollisionEnter(Collision collision)
+ {
+ if (string.IsNullOrEmpty(tag.Value) || tag.Value.Equals(collision.gameObject.tag)) {
+ collidedGameObject.Value = collision.gameObject;
+ enteredCollision = true;
+ }
+ }
+
+ public override void OnReset()
+ {
+ tag = "";
+ collidedGameObject = null;
+ }
+ }
+}
\ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredCollision.cs.meta b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredCollision.cs.meta new file mode 100644 index 00000000..b6f4d04b --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredCollision.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2
+guid: c1841a802d7ceda449423f001897ecae
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredCollision2D.cs b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredCollision2D.cs new file mode 100644 index 00000000..51feb050 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredCollision2D.cs @@ -0,0 +1,41 @@ +using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks
+{
+ [TaskDescription("Returns success when a 2D collision starts.")]
+ [TaskCategory("Physics")]
+ [HelpURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=110")]
+ public class HasEnteredCollision2D : Conditional
+ {
+ [Tooltip("The tag of the GameObject to check for a collision against")]
+ public SharedString tag = "";
+ [Tooltip("The object that started the collision")]
+ public SharedGameObject collidedGameObject;
+
+ private bool enteredCollision = false;
+
+ public override TaskStatus OnUpdate()
+ {
+ return enteredCollision ? TaskStatus.Success : TaskStatus.Failure;
+ }
+
+ public override void OnEnd()
+ {
+ enteredCollision = false;
+ }
+
+ public override void OnCollisionEnter2D(Collision2D collision)
+ {
+ if (string.IsNullOrEmpty(tag.Value) || tag.Value.Equals(collision.gameObject.tag)) {
+ collidedGameObject.Value = collision.gameObject;
+ enteredCollision = true;
+ }
+ }
+
+ public override void OnReset()
+ {
+ tag = "";
+ collidedGameObject = null;
+ }
+ }
+}
diff --git a/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredCollision2D.cs.meta b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredCollision2D.cs.meta new file mode 100644 index 00000000..1f0e945e --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredCollision2D.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2
+guid: 0ac128198630a2d4b9fee93cc9a1f8fd
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredTrigger.cs b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredTrigger.cs new file mode 100644 index 00000000..648850fd --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredTrigger.cs @@ -0,0 +1,41 @@ +using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks
+{
+ [TaskDescription("Returns success when an object enters the trigger.")]
+ [TaskCategory("Physics")]
+ [HelpURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=110")]
+ public class HasEnteredTrigger : Conditional
+ {
+ [Tooltip("The tag of the GameObject to check for a trigger against")]
+ public SharedString tag = "";
+ [Tooltip("The object that entered the trigger")]
+ public SharedGameObject otherGameObject;
+
+ private bool enteredTrigger = false;
+
+ public override TaskStatus OnUpdate()
+ {
+ return enteredTrigger ? TaskStatus.Success : TaskStatus.Failure;
+ }
+
+ public override void OnEnd()
+ {
+ enteredTrigger = false;
+ }
+
+ public override void OnTriggerEnter(Collider other)
+ {
+ if (string.IsNullOrEmpty(tag.Value) || tag.Value.Equals(other.gameObject.tag)) {
+ otherGameObject.Value = other.gameObject;
+ enteredTrigger = true;
+ }
+ }
+
+ public override void OnReset()
+ {
+ tag = "";
+ otherGameObject = null;
+ }
+ }
+}
\ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredTrigger.cs.meta b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredTrigger.cs.meta new file mode 100644 index 00000000..bccb63ad --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredTrigger.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2
+guid: 5987844efe0fca7499cec04a9e3962cc
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredTrigger2D.cs b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredTrigger2D.cs new file mode 100644 index 00000000..05dfe9ec --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredTrigger2D.cs @@ -0,0 +1,41 @@ +using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks
+{
+ [TaskDescription("Returns success when an object enters the 2D trigger.")]
+ [TaskCategory("Physics")]
+ [HelpURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=110")]
+ public class HasEnteredTrigger2D : Conditional
+ {
+ [Tooltip("The tag of the GameObject to check for a trigger against")]
+ public SharedString tag = "";
+ [Tooltip("The object that entered the trigger")]
+ public SharedGameObject otherGameObject;
+
+ private bool enteredTrigger = false;
+
+ public override TaskStatus OnUpdate()
+ {
+ return enteredTrigger ? TaskStatus.Success : TaskStatus.Failure;
+ }
+
+ public override void OnEnd()
+ {
+ enteredTrigger = false;
+ }
+
+ public override void OnTriggerEnter2D(Collider2D other)
+ {
+ if (string.IsNullOrEmpty(tag.Value) || tag.Value.Equals(other.gameObject.tag)) {
+ otherGameObject.Value = other.gameObject;
+ enteredTrigger = true;
+ }
+ }
+
+ public override void OnReset()
+ {
+ tag = "";
+ otherGameObject = null;
+ }
+ }
+}
diff --git a/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredTrigger2D.cs.meta b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredTrigger2D.cs.meta new file mode 100644 index 00000000..4e98e7c7 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasEnteredTrigger2D.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2
+guid: 84e2afb791fe67243a15e45e4af81bb4
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedCollision.cs b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedCollision.cs new file mode 100644 index 00000000..05a4fe3d --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedCollision.cs @@ -0,0 +1,40 @@ +using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks
+{
+ [TaskDescription("Returns success when a collision ends.")]
+ [TaskCategory("Physics")]
+ [HelpURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=110")]
+ public class HasExitedCollision : Conditional
+ {
+ [Tooltip("The tag of the GameObject to check for a collision against")]
+ public SharedString tag = "";
+ [Tooltip("The object that exited the collision")]
+ public SharedGameObject collidedGameObject;
+
+ private bool exitedCollision = false;
+
+ public override TaskStatus OnUpdate()
+ {
+ return exitedCollision ? TaskStatus.Success : TaskStatus.Failure;
+ }
+
+ public override void OnEnd()
+ {
+ exitedCollision = false;
+ }
+
+ public override void OnCollisionExit(Collision collision)
+ {
+ if (string.IsNullOrEmpty(tag.Value) || tag.Value.Equals(collision.gameObject.tag)) {
+ collidedGameObject.Value = collision.gameObject;
+ exitedCollision = true;
+ }
+ }
+
+ public override void OnReset()
+ {
+ collidedGameObject = null;
+ }
+ }
+}
\ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedCollision.cs.meta b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedCollision.cs.meta new file mode 100644 index 00000000..40e22c8b --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedCollision.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2
+guid: 900905a3e42f74c49a6e503349ee651e
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedCollision2D.cs b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedCollision2D.cs new file mode 100644 index 00000000..e5a1a03a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedCollision2D.cs @@ -0,0 +1,41 @@ +using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks
+{
+ [TaskDescription("Returns success when a 2D collision ends.")]
+ [TaskCategory("Physics")]
+ [HelpURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=110")]
+ public class HasExitedCollision2D : Conditional
+ {
+ [Tooltip("The tag of the GameObject to check for a collision against")]
+ public SharedString tag = "";
+ [Tooltip("The object that exited the collision")]
+ public SharedGameObject collidedGameObject;
+
+ private bool exitedCollision = false;
+
+ public override TaskStatus OnUpdate()
+ {
+ return exitedCollision ? TaskStatus.Success : TaskStatus.Failure;
+ }
+
+ public override void OnEnd()
+ {
+ exitedCollision = false;
+ }
+
+ public override void OnCollisionExit2D(Collision2D collision)
+ {
+ if (string.IsNullOrEmpty(tag.Value) || tag.Value.Equals(collision.gameObject.tag)) {
+ collidedGameObject.Value = collision.gameObject;
+ exitedCollision = true;
+ }
+ }
+
+ public override void OnReset()
+ {
+ tag = "";
+ collidedGameObject = null;
+ }
+ }
+}
diff --git a/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedCollision2D.cs.meta b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedCollision2D.cs.meta new file mode 100644 index 00000000..48510c2a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedCollision2D.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2
+guid: 31cf8edd114ac5c4db22ec65babb3dd3
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedTrigger.cs b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedTrigger.cs new file mode 100644 index 00000000..ec33e923 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedTrigger.cs @@ -0,0 +1,41 @@ +using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks
+{
+ [TaskDescription("Returns success when an object exits the trigger.")]
+ [TaskCategory("Physics")]
+ [HelpURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=110")]
+ public class HasExitedTrigger : Conditional
+ {
+ [Tooltip("The tag of the GameObject to check for a trigger against")]
+ public SharedString tag = "";
+ [Tooltip("The object that exited the trigger")]
+ public SharedGameObject otherGameObject;
+
+ private bool exitedTrigger = false;
+
+ public override TaskStatus OnUpdate()
+ {
+ return exitedTrigger ? TaskStatus.Success : TaskStatus.Failure;
+ }
+
+ public override void OnEnd()
+ {
+ exitedTrigger = false;
+ }
+
+ public override void OnTriggerExit(Collider other)
+ {
+ if (string.IsNullOrEmpty(tag.Value) || tag.Value.Equals(other.gameObject.tag)) {
+ otherGameObject.Value = other.gameObject;
+ exitedTrigger = true;
+ }
+ }
+
+ public override void OnReset()
+ {
+ tag = "";
+ otherGameObject = null;
+ }
+ }
+}
\ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedTrigger.cs.meta b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedTrigger.cs.meta new file mode 100644 index 00000000..83c2828f --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedTrigger.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2
+guid: c7ccd4a2c35d4c748b65ccd086e777e1
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedTrigger2D.cs b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedTrigger2D.cs new file mode 100644 index 00000000..95ad2f1a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedTrigger2D.cs @@ -0,0 +1,41 @@ +using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks
+{
+ [TaskDescription("Returns success when an object exits the 2D trigger.")]
+ [TaskCategory("Physics")]
+ [HelpURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=110")]
+ public class HasExitedTrigger2D : Conditional
+ {
+ [Tooltip("The tag of the GameObject to check for a trigger against")]
+ public SharedString tag = "";
+ [Tooltip("The object that exited the trigger")]
+ public SharedGameObject otherGameObject;
+
+ private bool exitedTrigger = false;
+
+ public override TaskStatus OnUpdate()
+ {
+ return exitedTrigger ? TaskStatus.Success : TaskStatus.Failure;
+ }
+
+ public override void OnEnd()
+ {
+ exitedTrigger = false;
+ }
+
+ public override void OnTriggerExit2D(Collider2D other)
+ {
+ if (string.IsNullOrEmpty(tag.Value) || tag.Value.Equals(other.gameObject.tag)) {
+ otherGameObject.Value = other.gameObject;
+ exitedTrigger = true;
+ }
+ }
+
+ public override void OnReset()
+ {
+ tag = "";
+ otherGameObject = null;
+ }
+ }
+}
diff --git a/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedTrigger2D.cs.meta b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedTrigger2D.cs.meta new file mode 100644 index 00000000..3d6d4f8a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Conditionals/Physics/HasExitedTrigger2D.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2
+guid: ff0486d46da2f7844ac74c6e2ad5af89
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
|