summaryrefslogtreecommitdiff
path: root/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D')
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/GetCenter.cs47
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/GetCenter.cs.meta8
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/GetSize.cs45
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/GetSize.cs.meta8
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/SetCenter.cs46
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/SetCenter.cs.meta8
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/SetSize.cs44
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/SetSize.cs.meta8
8 files changed, 214 insertions, 0 deletions
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/GetCenter.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/GetCenter.cs
new file mode 100644
index 00000000..60c05b77
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/GetCenter.cs
@@ -0,0 +1,47 @@
+#if UNITY_4_6 || UNITY_4_7
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityBoxCollider2D
+{
+ [TaskCategory("Basic/BoxCollider2D")]
+ [TaskDescription("Stores the center of the BoxCollider2D. 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 BoxCollider2D")]
+ [RequiredField]
+ public SharedVector2 storeValue;
+
+ private BoxCollider2D boxCollider2D;
+ private GameObject prevGameObject;
+
+ public override void OnStart()
+ {
+ var currentGameObject = GetDefaultGameObject(targetGameObject.Value);
+ if (currentGameObject != prevGameObject) {
+ boxCollider2D = currentGameObject.GetComponent<BoxCollider2D>();
+ prevGameObject = currentGameObject;
+ }
+ }
+
+ public override TaskStatus OnUpdate()
+ {
+ if (boxCollider2D == null) {
+ Debug.LogWarning("BoxCollider2D is null");
+ return TaskStatus.Failure;
+ }
+
+ storeValue.Value = boxCollider2D.center;
+
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ targetGameObject = null;
+ storeValue = Vector2.zero;
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/GetCenter.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/GetCenter.cs.meta
new file mode 100644
index 00000000..87ce1000
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/GetCenter.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 97045dc4cff50664994b74ec1d41dfb9
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/GetSize.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/GetSize.cs
new file mode 100644
index 00000000..e539eb30
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/GetSize.cs
@@ -0,0 +1,45 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityBoxCollider2D
+{
+ [TaskCategory("Basic/BoxCollider2D")]
+ [TaskDescription("Stores the size of the BoxCollider2D. Returns Success.")]
+ public class GetSize : Action
+ {
+ [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")]
+ public SharedGameObject targetGameObject;
+ [Tooltip("The size of the BoxCollider2D")]
+ [RequiredField]
+ public SharedVector2 storeValue;
+
+ private BoxCollider2D boxCollider2D;
+ private GameObject prevGameObject;
+
+ public override void OnStart()
+ {
+ var currentGameObject = GetDefaultGameObject(targetGameObject.Value);
+ if (currentGameObject != prevGameObject) {
+ boxCollider2D = currentGameObject.GetComponent<BoxCollider2D>();
+ prevGameObject = currentGameObject;
+ }
+ }
+
+ public override TaskStatus OnUpdate()
+ {
+ if (boxCollider2D == null) {
+ Debug.LogWarning("BoxCollider2D is null");
+ return TaskStatus.Failure;
+ }
+
+ storeValue.Value = boxCollider2D.size;
+
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ targetGameObject = null;
+ storeValue = Vector2.zero;
+ }
+ }
+}
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/GetSize.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/GetSize.cs.meta
new file mode 100644
index 00000000..362df45f
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/GetSize.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c69113b787759f340aacbb9d99a6d654
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/SetCenter.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/SetCenter.cs
new file mode 100644
index 00000000..f6c74d1c
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/SetCenter.cs
@@ -0,0 +1,46 @@
+#if UNITY_4_6 || UNITY_4_7
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityBoxCollider2D
+{
+ [TaskCategory("Basic/BoxCollider2D")]
+ [TaskDescription("Sets the center of the BoxCollider2D. 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 BoxCollider2D")]
+ public SharedVector2 center;
+
+ private BoxCollider2D boxCollider2D;
+ private GameObject prevGameObject;
+
+ public override void OnStart()
+ {
+ var currentGameObject = GetDefaultGameObject(targetGameObject.Value);
+ if (currentGameObject != prevGameObject) {
+ boxCollider2D = currentGameObject.GetComponent<BoxCollider2D>();
+ prevGameObject = currentGameObject;
+ }
+ }
+
+ public override TaskStatus OnUpdate()
+ {
+ if (boxCollider2D == null) {
+ Debug.LogWarning("BoxCollider2D is null");
+ return TaskStatus.Failure;
+ }
+
+ boxCollider2D.center = center.Value;
+
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ targetGameObject = null;
+ center = Vector2.zero;
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/SetCenter.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/SetCenter.cs.meta
new file mode 100644
index 00000000..70e26e5b
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/SetCenter.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: beddee09fde7fe24b894ef43edc1998a
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/SetSize.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/SetSize.cs
new file mode 100644
index 00000000..5de4a500
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/SetSize.cs
@@ -0,0 +1,44 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityBoxCollider2D
+{
+ [TaskCategory("Basic/BoxCollider2D")]
+ [TaskDescription("Sets the size of the BoxCollider2D. Returns Success.")]
+ public class SetSize : Action
+ {
+ [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")]
+ public SharedGameObject targetGameObject;
+ [Tooltip("The size of the BoxCollider2D")]
+ public SharedVector2 size;
+
+ private BoxCollider2D boxCollider2D;
+ private GameObject prevGameObject;
+
+ public override void OnStart()
+ {
+ var currentGameObject = GetDefaultGameObject(targetGameObject.Value);
+ if (currentGameObject != prevGameObject) {
+ boxCollider2D = currentGameObject.GetComponent<BoxCollider2D>();
+ prevGameObject = currentGameObject;
+ }
+ }
+
+ public override TaskStatus OnUpdate()
+ {
+ if (boxCollider2D == null) {
+ Debug.LogWarning("BoxCollider2D is null");
+ return TaskStatus.Failure;
+ }
+
+ boxCollider2D.size = size.Value;
+
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ targetGameObject = null;
+ size = Vector2.zero;
+ }
+ }
+}
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/SetSize.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/SetSize.cs.meta
new file mode 100644
index 00000000..f5af4e82
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/BoxCollider2D/SetSize.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 1875fd00045d98848b028015a17aeeaf
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData: