diff options
Diffstat (limited to 'Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider')
8 files changed, 209 insertions, 0 deletions
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/GetCenter.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/GetCenter.cs new file mode 100644 index 00000000..84793c5b --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/GetCenter.cs @@ -0,0 +1,44 @@ +using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnitySphereCollider
+{
+ [TaskCategory("Basic/SphereCollider")]
+ [TaskDescription("Stores the center of the SphereCollider. Returns Success.")]
+ public class GetCenter : Action
+ {
+ [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")]
+ public SharedGameObject targetGameObject;
+ [Tooltip("The center of the SphereCollider")]
+ [RequiredField]
+ public SharedVector3 storeValue;
+
+ private SphereCollider sphereCollider;
+ private GameObject prevGameObject;
+
+ public override void OnStart()
+ {
+ var currentGameObject = GetDefaultGameObject(targetGameObject.Value);
+ if (currentGameObject != prevGameObject) {
+ sphereCollider = currentGameObject.GetComponent<SphereCollider>();
+ prevGameObject = currentGameObject;
+ }
+ }
+
+ public override TaskStatus OnUpdate()
+ {
+ if (sphereCollider == null) {
+ Debug.LogWarning("SphereCollider is null");
+ return TaskStatus.Failure;
+ }
+
+ storeValue.Value = sphereCollider.center;
+
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ storeValue = Vector3.zero;
+ }
+ }
+}
\ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/GetCenter.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/GetCenter.cs.meta new file mode 100644 index 00000000..19d5324a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/GetCenter.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2
+guid: d95a2896b550c5b4382b7ed35860f504
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/GetRadius.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/GetRadius.cs new file mode 100644 index 00000000..81531b9e --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/GetRadius.cs @@ -0,0 +1,45 @@ +using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnitySphereCollider
+{
+ [TaskCategory("Basic/SphereCollider")]
+ [TaskDescription("Stores the radius of the SphereCollider. Returns Success.")]
+ public class GetRadius : Action
+ {
+ [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")]
+ public SharedGameObject targetGameObject;
+ [Tooltip("The radius of the SphereCollider")]
+ [RequiredField]
+ public SharedFloat storeValue;
+
+ private SphereCollider sphereCollider;
+ private GameObject prevGameObject;
+
+ public override void OnStart()
+ {
+ var currentGameObject = GetDefaultGameObject(targetGameObject.Value);
+ if (currentGameObject != prevGameObject) {
+ sphereCollider = currentGameObject.GetComponent<SphereCollider>();
+ prevGameObject = currentGameObject;
+ }
+ }
+
+ public override TaskStatus OnUpdate()
+ {
+ if (sphereCollider == null) {
+ Debug.LogWarning("SphereCollider is null");
+ return TaskStatus.Failure;
+ }
+
+ storeValue.Value = sphereCollider.radius;
+
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ targetGameObject = null;
+ storeValue = 0;
+ }
+ }
+}
\ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/GetRadius.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/GetRadius.cs.meta new file mode 100644 index 00000000..483f418a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/GetRadius.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2
+guid: 2ff93bf538eee1444b3c51aadfc9bb7f
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/SetCenter.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/SetCenter.cs new file mode 100644 index 00000000..068800e1 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/SetCenter.cs @@ -0,0 +1,44 @@ +using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnitySphereCollider
+{
+ [TaskCategory("Basic/SphereCollider")]
+ [TaskDescription("Sets the center of the SphereCollider. Returns Success.")]
+ public class SetCenter : Action
+ {
+ [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")]
+ public SharedGameObject targetGameObject;
+ [Tooltip("The center of the SphereCollider")]
+ public SharedVector3 center;
+
+ private SphereCollider sphereCollider;
+ private GameObject prevGameObject;
+
+ public override void OnStart()
+ {
+ var currentGameObject = GetDefaultGameObject(targetGameObject.Value);
+ if (currentGameObject != prevGameObject) {
+ sphereCollider = currentGameObject.GetComponent<SphereCollider>();
+ prevGameObject = currentGameObject;
+ }
+ }
+
+ public override TaskStatus OnUpdate()
+ {
+ if (sphereCollider == null) {
+ Debug.LogWarning("SphereCollider is null");
+ return TaskStatus.Failure;
+ }
+
+ sphereCollider.center = center.Value;
+
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ targetGameObject = null;
+ center = Vector3.zero;
+ }
+ }
+}
\ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/SetCenter.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/SetCenter.cs.meta new file mode 100644 index 00000000..a9af8a3a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/SetCenter.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2
+guid: dffebfe905e60814ab75e0d7c57432ec
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/SetRadius.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/SetRadius.cs new file mode 100644 index 00000000..483bae53 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/SetRadius.cs @@ -0,0 +1,44 @@ +using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnitySphereCollider
+{
+ [TaskCategory("Basic/SphereCollider")]
+ [TaskDescription("Sets the radius of the SphereCollider. Returns Success.")]
+ public class SetRadius : Action
+ {
+ [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")]
+ public SharedGameObject targetGameObject;
+ [Tooltip("The radius of the SphereCollider")]
+ public SharedFloat radius;
+
+ private SphereCollider sphereCollider;
+ private GameObject prevGameObject;
+
+ public override void OnStart()
+ {
+ var currentGameObject = GetDefaultGameObject(targetGameObject.Value);
+ if (currentGameObject != prevGameObject) {
+ sphereCollider = currentGameObject.GetComponent<SphereCollider>();
+ prevGameObject = currentGameObject;
+ }
+ }
+
+ public override TaskStatus OnUpdate()
+ {
+ if (sphereCollider == null) {
+ Debug.LogWarning("SphereCollider is null");
+ return TaskStatus.Failure;
+ }
+
+ sphereCollider.radius = radius.Value;
+
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ targetGameObject = null;
+ radius = 0;
+ }
+ }
+}
\ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/SetRadius.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/SetRadius.cs.meta new file mode 100644 index 00000000..c1855dd0 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SphereCollider/SetRadius.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2
+guid: 5f45a94e6b603f2498481f61218b1769
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
|