diff --git a/BlueWater/Assets/Behavior Designer.meta b/BlueWater/Assets/Behavior Designer.meta new file mode 100644 index 000000000..850cf77a6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 7b303277dfa449d4a93437535228816d +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Documentation.pdf b/BlueWater/Assets/Behavior Designer/Documentation.pdf new file mode 100644 index 000000000..de5ce33f3 Binary files /dev/null and b/BlueWater/Assets/Behavior Designer/Documentation.pdf differ diff --git a/BlueWater/Assets/Behavior Designer/Documentation.pdf.meta b/BlueWater/Assets/Behavior Designer/Documentation.pdf.meta new file mode 100644 index 000000000..0c96b2ac4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Documentation.pdf.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4646946da2762db46a08e76a6c42f832 +DefaultImporter: + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Documentation.pdf + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Editor.meta b/BlueWater/Assets/Behavior Designer/Editor.meta new file mode 100644 index 000000000..8584cfce3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3aa7d582439bc2f4da8254d1364e0f41 diff --git a/BlueWater/Assets/Behavior Designer/Editor/BehaviorDesigner.Editor.dll b/BlueWater/Assets/Behavior Designer/Editor/BehaviorDesigner.Editor.dll new file mode 100644 index 000000000..59d651ac9 Binary files /dev/null and b/BlueWater/Assets/Behavior Designer/Editor/BehaviorDesigner.Editor.dll differ diff --git a/BlueWater/Assets/Behavior Designer/Editor/BehaviorDesigner.Editor.dll.meta b/BlueWater/Assets/Behavior Designer/Editor/BehaviorDesigner.Editor.dll.meta new file mode 100644 index 000000000..20b99223f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor/BehaviorDesigner.Editor.dll.meta @@ -0,0 +1,40 @@ +fileFormatVersion: 2 +guid: af72b091e5876924c9ab327b2d8de270 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Editor/BehaviorDesigner.Editor.dll + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Editor/BehaviorTreeInspector.cs b/BlueWater/Assets/Behavior Designer/Editor/BehaviorTreeInspector.cs new file mode 100644 index 000000000..aa1021dfd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor/BehaviorTreeInspector.cs @@ -0,0 +1,11 @@ +using UnityEditor; +using BehaviorDesigner.Runtime; + +namespace BehaviorDesigner.Editor +{ + [CustomEditor(typeof(BehaviorTree))] + public class BehaviorTreeInspector : BehaviorInspector + { + // intentionally left blank + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Editor/BehaviorTreeInspector.cs.meta b/BlueWater/Assets/Behavior Designer/Editor/BehaviorTreeInspector.cs.meta new file mode 100644 index 000000000..70114151e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor/BehaviorTreeInspector.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 94693c6931cea70439c26417a1fc0d33 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Editor/BehaviorTreeInspector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Editor/ExternalBehaviorTreeInspector.cs b/BlueWater/Assets/Behavior Designer/Editor/ExternalBehaviorTreeInspector.cs new file mode 100644 index 000000000..24da0b8cc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor/ExternalBehaviorTreeInspector.cs @@ -0,0 +1,12 @@ +using UnityEngine; +using UnityEditor; +using BehaviorDesigner.Runtime; + +namespace BehaviorDesigner.Editor +{ + [CustomEditor(typeof(ExternalBehaviorTree))] + public class ExternalBehaviorTreeInspector : ExternalBehaviorInspector + { + // intentionally left blank + } +} diff --git a/BlueWater/Assets/Behavior Designer/Editor/ExternalBehaviorTreeInspector.cs.meta b/BlueWater/Assets/Behavior Designer/Editor/ExternalBehaviorTreeInspector.cs.meta new file mode 100644 index 000000000..3c1333e3d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor/ExternalBehaviorTreeInspector.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1f0cb79f53e760c4d950b8c6ade6a242 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Editor/ExternalBehaviorTreeInspector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Editor/GridShader.shader b/BlueWater/Assets/Behavior Designer/Editor/GridShader.shader new file mode 100644 index 000000000..8fe5b740e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor/GridShader.shader @@ -0,0 +1,44 @@ +Shader "Hidden/Behavior Designer/Grid" { + SubShader { + Pass { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + fixed4 frag(v2f_img i) : Color { + return fixed4(0.21, 0.21, 0.21, 1); + } + ENDCG + } + Pass { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + fixed4 frag(v2f_img i) : Color { + return fixed4(0.33, 0.33, 0.33, 1); + } + ENDCG + } + Pass { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + fixed4 frag(v2f_img i) : Color { + return fixed4(0.26, 0.26, 0.26, 1); + } + ENDCG + } + Pass { + CGPROGRAM + #pragma vertex vert_img + #pragma fragment frag + #include "UnityCG.cginc" + fixed4 frag(v2f_img i) : Color { + return fixed4(0.27, 0.27, 0.27, 1); + } + ENDCG + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Editor/GridShader.shader.meta b/BlueWater/Assets/Behavior Designer/Editor/GridShader.shader.meta new file mode 100644 index 000000000..92cc7eba8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor/GridShader.shader.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: afbd9f0fb1c22d1409403fdef158479f +ShaderImporter: + defaultTextures: [] + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Editor/GridShader.shader + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Editor/Object Drawers.meta b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers.meta new file mode 100644 index 000000000..a7ead9df4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 956347559c803f7489f75873ef2715e5 +folderAsset: yes +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/FloatSliderDrawer.cs b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/FloatSliderDrawer.cs new file mode 100644 index 000000000..b3cad0ed0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/FloatSliderDrawer.cs @@ -0,0 +1,22 @@ +using UnityEngine; +using UnityEditor; +using BehaviorDesigner.Runtime; +using BehaviorDesigner.Runtime.ObjectDrawers; + +namespace BehaviorDesigner.Editor.ObjectDrawers +{ + [CustomObjectDrawer(typeof(FloatSliderAttribute))] + public class FloatSliderDrawer : ObjectDrawer + { + public override void OnGUI(GUIContent label) + { + var floatSliderAttribute = (FloatSliderAttribute)attribute; + if (value is SharedFloat) { + var sharedFloat = value as SharedFloat; + sharedFloat.Value = EditorGUILayout.Slider(label, sharedFloat.Value, floatSliderAttribute.min, floatSliderAttribute.max); + } else { + value = EditorGUILayout.Slider(label, (float)value, floatSliderAttribute.min, floatSliderAttribute.max); + } + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/FloatSliderDrawer.cs.meta b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/FloatSliderDrawer.cs.meta new file mode 100644 index 000000000..5037a96cc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/FloatSliderDrawer.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5f0987c6ff37141458ff776277e2b65a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Editor/Object Drawers/FloatSliderDrawer.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/IntSliderDrawer.cs b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/IntSliderDrawer.cs new file mode 100644 index 000000000..d6107b8ec --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/IntSliderDrawer.cs @@ -0,0 +1,22 @@ +using UnityEngine; +using UnityEditor; +using BehaviorDesigner.Runtime; +using BehaviorDesigner.Runtime.ObjectDrawers; + +namespace BehaviorDesigner.Editor.ObjectDrawers +{ + [CustomObjectDrawer(typeof(IntSliderAttribute))] + public class IntSliderDrawer : ObjectDrawer + { + public override void OnGUI(GUIContent label) + { + var intSliderAttribute = (IntSliderAttribute)attribute; + if (value is SharedInt) { + var sharedFloat = value as SharedInt; + sharedFloat.Value = EditorGUILayout.IntSlider(label, sharedFloat.Value, intSliderAttribute.min, intSliderAttribute.max); + } else { + value = EditorGUILayout.IntSlider(label, (int)value, intSliderAttribute.min, intSliderAttribute.max); + } + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/IntSliderDrawer.cs.meta b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/IntSliderDrawer.cs.meta new file mode 100644 index 000000000..e0981f3b7 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/IntSliderDrawer.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ed5dac524fa5f61468bb6ca49a556b3b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Editor/Object Drawers/IntSliderDrawer.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/StackedActionDrawer.cs b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/StackedActionDrawer.cs new file mode 100644 index 000000000..febe2dd58 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/StackedActionDrawer.cs @@ -0,0 +1,146 @@ +using UnityEngine; +using UnityEditor; +using UnityEditorInternal; +using BehaviorDesigner.Runtime.Tasks; +using System; +using System.Reflection; + +using Action = BehaviorDesigner.Runtime.Tasks.Action; + +namespace BehaviorDesigner.Editor.ObjectDrawers +{ + [CustomObjectDrawer(typeof(StackedAction))] + public class StackedActionDrawer : ObjectDrawer + { + private ReorderableList reorderableList; + private StackedAction lastStackedAction; + + public override void OnGUI(GUIContent label) + { + var stackedAction = task as StackedAction; + + stackedAction.comparisonType = (StackedAction.ComparisonType)FieldInspector.DrawField(stackedAction, + new GUIContent("Comparison Type", "Specifies if the tasks should be traversed with an AND (Sequence) or an OR (Selector)."), + stackedAction.GetType().GetField("comparisonType", BindingFlags.Instance | BindingFlags.Public), + stackedAction.comparisonType); + + stackedAction.graphLabel = (bool)FieldInspector.DrawField(stackedAction, + new GUIContent("Graph Label", "Should the tasks be labeled within te graph?"), + stackedAction.GetType().GetField("graphLabel", BindingFlags.Instance | BindingFlags.Public), + stackedAction.graphLabel); + + if (stackedAction.actions == null) { + stackedAction.actions = new Action[0]; + } + + if (reorderableList == null) { + reorderableList = new ReorderableList(stackedAction.actions, typeof(Action), true, true, true, true); + reorderableList.drawHeaderCallback += (Rect rect) => + { + EditorGUI.LabelField(rect, "Actions"); + }; + reorderableList.onAddDropdownCallback += OnAddDropdownCallback; + reorderableList.drawElementCallback += OnDrawElementCallback; + reorderableList.onReorderCallback += OnReorderCallback; + reorderableList.onSelectCallback += OnSelectCallback; + reorderableList.onCanRemoveCallback += OnCanRemoveCallback; + reorderableList.onRemoveCallback += OnRemoveCallback; + } + if (stackedAction != lastStackedAction) { + lastStackedAction = stackedAction; + var index = EditorPrefs.GetInt("BehaviorDesigner.StackedAction." + stackedAction.ID, -1); + if (index < stackedAction.actions.Length) { + reorderableList.index = index; + } + } + if (reorderableList.index == -1 && stackedAction.actions.Length > 0) { + reorderableList.index = 0; + } + reorderableList.DoLayoutList(); + + if (reorderableList.index >= 0 && stackedAction.actions != null && reorderableList.index < stackedAction.actions.Length) { + var selectedAction = stackedAction.actions[reorderableList.index]; + EditorGUILayout.LabelField(selectedAction.GetType().Name, BehaviorDesignerUtility.BoldLabelGUIStyle); + FieldInspector.DrawFields(selectedAction, selectedAction); + } + } + + private void OnAddDropdownCallback(Rect buttonRect, ReorderableList list) + { + var addMenu = new GenericMenu(); + BehaviorDesignerWindow.instance.TaskList.AddTaskTypesToMenu(0, ref addMenu, null, typeof(StackedAction), string.Empty, false, OnAddTask); + addMenu.ShowAsContext(); + } + + private void OnAddTask(object obj) + { + var stackedAction = task as StackedAction; + var actions = stackedAction.actions; + Array.Resize(ref actions, actions.Length + 1); + var taskType = obj as Type; + actions[actions.Length - 1] = Activator.CreateInstance(taskType) as Action; + reorderableList.list = stackedAction.actions = actions; + reorderableList.index = actions.Length - 1; + BehaviorDesignerWindow.instance.SaveBehavior(); + } + + private void OnDrawElementCallback(Rect rect, int index, bool isActive, bool isFocused) + { + var stackedAction = task as StackedAction; + if (stackedAction.actions == null || index >= stackedAction.actions.Length || stackedAction.actions[index] == null) { + if (stackedAction.actions != null && index < stackedAction.actions.Length) { + var actions = stackedAction.actions; + ArrayUtility.RemoveAt(ref actions, index); + reorderableList.list = stackedAction.actions = actions; + BehaviorDesignerWindow.instance.SaveBehavior(); + } + return; + } + EditorGUI.LabelField(rect, stackedAction.actions[index].GetType().Name); + if (stackedAction.actions[index].NodeData == null || stackedAction.NodeData == null || !Application.isPlaying) { + return; + } + + if (stackedAction.actions[index].NodeData.ExecutionStatus == TaskStatus.Success || stackedAction.actions[index].NodeData.ExecutionStatus == TaskStatus.Failure) { + Texture2D texture; + if (stackedAction.NodeData.IsReevaluating) { + texture = stackedAction.actions[index].NodeData.ExecutionStatus == TaskStatus.Failure ? BehaviorDesignerUtility.ExecutionFailureRepeatTexture : BehaviorDesignerUtility.ExecutionSuccessRepeatTexture; + } else { + texture = stackedAction.actions[index].NodeData.ExecutionStatus == TaskStatus.Failure ? BehaviorDesignerUtility.ExecutionFailureTexture : BehaviorDesignerUtility.ExecutionSuccessTexture; + } + rect.x = rect.width + 8; + rect.width = rect.height = 16; + GUI.DrawTexture(rect, texture); + } + } + + private void OnReorderCallback(ReorderableList list) + { + var stackedActions = task as StackedAction; + stackedActions.actions = (Action[])list.list; + BehaviorDesignerWindow.instance.SaveBehavior(); + } + + private void OnSelectCallback(ReorderableList list) + { + EditorPrefs.SetInt("BehaviorDesigner.StackedAction." + task.ID, list.index); + } + + private bool OnCanRemoveCallback(ReorderableList list) + { + var stackedActions = task as StackedAction; + return stackedActions.actions != null && stackedActions.actions.Length > 0; + } + + private void OnRemoveCallback(ReorderableList list) + { + var stackedAction = task as StackedAction; + var actions = stackedAction.actions; + ArrayUtility.RemoveAt(ref actions, list.index); + reorderableList.list = stackedAction.actions = actions; + BehaviorDesignerWindow.instance.SaveBehavior(); + + reorderableList.index -= 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/StackedActionDrawer.cs.meta b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/StackedActionDrawer.cs.meta new file mode 100644 index 000000000..352a1c627 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/StackedActionDrawer.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 2dda1c5bd0726be428a9210c793769d7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Editor/Object Drawers/StackedActionDrawer.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/StackedConditionalDrawer.cs b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/StackedConditionalDrawer.cs new file mode 100644 index 000000000..a4285971d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/StackedConditionalDrawer.cs @@ -0,0 +1,144 @@ +using UnityEngine; +using UnityEditor; +using UnityEditorInternal; +using BehaviorDesigner.Runtime.Tasks; +using System; +using System.Reflection; + +namespace BehaviorDesigner.Editor.ObjectDrawers +{ + [CustomObjectDrawer(typeof(StackedConditional))] + public class StackedConditionalDrawer : ObjectDrawer + { + private ReorderableList reorderableList; + private StackedConditional lastStackedConditional; + + public override void OnGUI(GUIContent label) + { + var stackedConditional = task as StackedConditional; + + stackedConditional.comparisonType = (StackedConditional.ComparisonType)FieldInspector.DrawField(stackedConditional, + new GUIContent("Comparison Type", "Specifies if the tasks should be traversed with an AND (Sequence) or an OR (Selector)."), + stackedConditional.GetType().GetField("comparisonType", BindingFlags.Instance | BindingFlags.Public), + stackedConditional.comparisonType); + + stackedConditional.graphLabel = (bool)FieldInspector.DrawField(stackedConditional, + new GUIContent("Graph Label", "Should the tasks be labeled within te graph?"), + stackedConditional.GetType().GetField("graphLabel", BindingFlags.Instance | BindingFlags.Public), + stackedConditional.graphLabel); + + if (stackedConditional.conditionals == null) { + stackedConditional.conditionals = new Conditional[0]; + } + + if (reorderableList == null) { + reorderableList = new ReorderableList(stackedConditional.conditionals, typeof(Conditional), true, true, true, true); + reorderableList.drawHeaderCallback += (Rect rect) => + { + EditorGUI.LabelField(rect, "Conditionals"); + }; + reorderableList.onAddDropdownCallback += OnAddDropdownCallback; + reorderableList.drawElementCallback += OnDrawElementCallback; + reorderableList.onReorderCallback += OnReorderCallback; + reorderableList.onSelectCallback += OnSelectCallback; + reorderableList.onCanRemoveCallback += OnCanRemoveCallback; + reorderableList.onRemoveCallback += OnRemoveCallback; + } + if (stackedConditional != lastStackedConditional) { + lastStackedConditional = stackedConditional; + var index = EditorPrefs.GetInt("BehaviorDesigner.StackedConditional." + stackedConditional.ID, -1); + if (index < stackedConditional.conditionals.Length) { + reorderableList.index = index; + } + } + if (reorderableList.index == -1 && stackedConditional.conditionals.Length > 0) { + reorderableList.index = 0; + } + reorderableList.DoLayoutList(); + + if (reorderableList.index >= 0 && stackedConditional.conditionals != null && reorderableList.index < stackedConditional.conditionals.Length) { + var selectedConditional = stackedConditional.conditionals[reorderableList.index]; + EditorGUILayout.LabelField(selectedConditional.GetType().Name, BehaviorDesignerUtility.BoldLabelGUIStyle); + FieldInspector.DrawFields(selectedConditional, selectedConditional); + } + } + + private void OnAddDropdownCallback(Rect buttonRect, ReorderableList list) + { + var addMenu = new GenericMenu(); + BehaviorDesignerWindow.instance.TaskList.AddTaskTypesToMenu(2, ref addMenu, null, typeof(StackedConditional), string.Empty, false, OnAddTask); + addMenu.ShowAsContext(); + } + + private void OnAddTask(object obj) + { + var stackedConditional = task as StackedConditional; + var conditionals = stackedConditional.conditionals; + Array.Resize(ref conditionals, conditionals.Length + 1); + var taskType = obj as Type; + conditionals[conditionals.Length - 1] = Activator.CreateInstance(taskType) as Conditional; + reorderableList.list = stackedConditional.conditionals = conditionals; + reorderableList.index = conditionals.Length - 1; + BehaviorDesignerWindow.instance.SaveBehavior(); + } + + private void OnDrawElementCallback(Rect rect, int index, bool isActive, bool isFocused) + { + var stackedConditional = task as StackedConditional; + if (stackedConditional.conditionals == null || index >= stackedConditional.conditionals.Length || stackedConditional.conditionals[index] == null) { + if (stackedConditional.conditionals != null && index < stackedConditional.conditionals.Length) { + var conditionals = stackedConditional.conditionals; + ArrayUtility.RemoveAt(ref conditionals, index); + reorderableList.list = stackedConditional.conditionals = conditionals; + BehaviorDesignerWindow.instance.SaveBehavior(); + } + return; + } + EditorGUI.LabelField(rect, stackedConditional.conditionals[index].GetType().Name); + if (stackedConditional.conditionals[index].NodeData == null || stackedConditional.NodeData == null || !Application.isPlaying) { + return; + } + + if (stackedConditional.conditionals[index].NodeData.ExecutionStatus == TaskStatus.Success || stackedConditional.conditionals[index].NodeData.ExecutionStatus == TaskStatus.Failure) { + Texture2D texture; + if (stackedConditional.NodeData.IsReevaluating) { + texture = stackedConditional.conditionals[index].NodeData.ExecutionStatus == TaskStatus.Failure ? BehaviorDesignerUtility.ExecutionFailureRepeatTexture : BehaviorDesignerUtility.ExecutionSuccessRepeatTexture; + } else { + texture = stackedConditional.conditionals[index].NodeData.ExecutionStatus == TaskStatus.Failure ? BehaviorDesignerUtility.ExecutionFailureTexture : BehaviorDesignerUtility.ExecutionSuccessTexture; + } + rect.x = rect.width + 8; + rect.width = rect.height = 16; + GUI.DrawTexture(rect, texture); + } + } + + private void OnReorderCallback(ReorderableList list) + { + var stackedConditionals = task as StackedConditional; + stackedConditionals.conditionals = (Conditional[])list.list; + BehaviorDesignerWindow.instance.SaveBehavior(); + } + + private void OnSelectCallback(ReorderableList list) + { + EditorPrefs.SetInt("BehaviorDesigner.StackedConditional." + task.ID, list.index); + } + + private bool OnCanRemoveCallback(ReorderableList list) + { + var stackedConditionals = task as StackedConditional; + return stackedConditionals.conditionals != null && stackedConditionals.conditionals.Length > 0; + } + + private void OnRemoveCallback(ReorderableList list) + { + var stackedConditional = task as StackedConditional; + var conditionals = stackedConditional.conditionals; + ArrayUtility.RemoveAt(ref conditionals, list.index); + reorderableList.list = stackedConditional.conditionals = conditionals; + BehaviorDesignerWindow.instance.SaveBehavior(); + + reorderableList.index -= 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/StackedConditionalDrawer.cs.meta b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/StackedConditionalDrawer.cs.meta new file mode 100644 index 000000000..a8c1abb7f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Editor/Object Drawers/StackedConditionalDrawer.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 1d12c12988e4c954b81ed7f3cdd0a439 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Editor/Object Drawers/StackedConditionalDrawer.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Integrations.meta b/BlueWater/Assets/Behavior Designer/Integrations.meta new file mode 100644 index 000000000..5daa076a5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Integrations.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 519776d3d02747548a264d7d32320ab1 +folderAsset: yes +timeCreated: 1536092918 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/BlueWater/Assets/Behavior Designer/Integrations/Readme.pdf b/BlueWater/Assets/Behavior Designer/Integrations/Readme.pdf new file mode 100644 index 000000000..a027079db Binary files /dev/null and b/BlueWater/Assets/Behavior Designer/Integrations/Readme.pdf differ diff --git a/BlueWater/Assets/Behavior Designer/Integrations/Readme.pdf.meta b/BlueWater/Assets/Behavior Designer/Integrations/Readme.pdf.meta new file mode 100644 index 000000000..99bac967f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Integrations/Readme.pdf.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a43abd9ecc0166043973a4ba6da07bf1 +DefaultImporter: + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Integrations/Readme.pdf + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime Source Code Location.pdf b/BlueWater/Assets/Behavior Designer/Runtime Source Code Location.pdf new file mode 100644 index 000000000..c011784c9 Binary files /dev/null and b/BlueWater/Assets/Behavior Designer/Runtime Source Code Location.pdf differ diff --git a/BlueWater/Assets/Behavior Designer/Runtime Source Code Location.pdf.meta b/BlueWater/Assets/Behavior Designer/Runtime Source Code Location.pdf.meta new file mode 100644 index 000000000..95babb344 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime Source Code Location.pdf.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f76522f0ea27769479b1c38979bac10a +DefaultImporter: + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime Source Code Location.pdf + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime.meta b/BlueWater/Assets/Behavior Designer/Runtime.meta new file mode 100644 index 000000000..b907fb904 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 33b3095a3727f544dbe47311776edb53 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/BehaviorDesigner.Runtime.dll b/BlueWater/Assets/Behavior Designer/Runtime/BehaviorDesigner.Runtime.dll new file mode 100644 index 000000000..a483d6c2b Binary files /dev/null and b/BlueWater/Assets/Behavior Designer/Runtime/BehaviorDesigner.Runtime.dll differ diff --git a/BlueWater/Assets/Behavior Designer/Runtime/BehaviorDesigner.Runtime.dll.meta b/BlueWater/Assets/Behavior Designer/Runtime/BehaviorDesigner.Runtime.dll.meta new file mode 100644 index 000000000..efda8ad33 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/BehaviorDesigner.Runtime.dll.meta @@ -0,0 +1,40 @@ +fileFormatVersion: 2 +guid: da41a8dd3b5ec434a802d9b5a2a0a777 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/BehaviorDesigner.Runtime.dll + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/BehaviorTree.cs b/BlueWater/Assets/Behavior Designer/Runtime/BehaviorTree.cs new file mode 100644 index 000000000..9a8bbb5cc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/BehaviorTree.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime +{ + // Wrapper for the Behavior class + [AddComponentMenu("Behavior Designer/Behavior Tree")] + public class BehaviorTree : Behavior + { + // intentionally left blank + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/BehaviorTree.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/BehaviorTree.cs.meta new file mode 100644 index 000000000..e5f5d4007 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/BehaviorTree.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 8d7b55c7ecdb49a4a89fa5e6f9022861 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 5b5f458971c6fd5459c51a7b8079bc3b, type: 3} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/BehaviorTree.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/ExternalBehaviorTree.cs b/BlueWater/Assets/Behavior Designer/Runtime/ExternalBehaviorTree.cs new file mode 100644 index 000000000..ad0e0f9e6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/ExternalBehaviorTree.cs @@ -0,0 +1,8 @@ +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class ExternalBehaviorTree : ExternalBehavior + { + // intentionally left blank + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/ExternalBehaviorTree.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/ExternalBehaviorTree.cs.meta new file mode 100644 index 000000000..150374dc5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/ExternalBehaviorTree.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b23f08d2ae4cba14087c1ed36193d82b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 5b5f458971c6fd5459c51a7b8079bc3b, type: 3} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/ExternalBehaviorTree.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Object Drawers.meta b/BlueWater/Assets/Behavior Designer/Runtime/Object Drawers.meta new file mode 100644 index 000000000..2e72caa10 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Object Drawers.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 29d0d8866b4fa984bbc7dbf5d988ebcc +folderAsset: yes +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Object Drawers/FloatSliderAttribute.cs b/BlueWater/Assets/Behavior Designer/Runtime/Object Drawers/FloatSliderAttribute.cs new file mode 100644 index 000000000..1f6a45192 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Object Drawers/FloatSliderAttribute.cs @@ -0,0 +1,16 @@ +using BehaviorDesigner.Runtime.Tasks; + +namespace BehaviorDesigner.Runtime.ObjectDrawers +{ + public class FloatSliderAttribute : ObjectDrawerAttribute + { + public float min; + public float max; + + public FloatSliderAttribute(float min, float max) + { + this.min = min; + this.max = max; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Object Drawers/FloatSliderAttribute.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Object Drawers/FloatSliderAttribute.cs.meta new file mode 100644 index 000000000..4a3b81546 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Object Drawers/FloatSliderAttribute.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 92948bfcff9a1fc48834935ebb0dbdcb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Object Drawers/FloatSliderAttribute.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Object Drawers/IntSliderAttribute.cs b/BlueWater/Assets/Behavior Designer/Runtime/Object Drawers/IntSliderAttribute.cs new file mode 100644 index 000000000..f73b1cb39 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Object Drawers/IntSliderAttribute.cs @@ -0,0 +1,16 @@ +using BehaviorDesigner.Runtime.Tasks; + +namespace BehaviorDesigner.Runtime.ObjectDrawers +{ + public class IntSliderAttribute : ObjectDrawerAttribute + { + public int min; + public int max; + + public IntSliderAttribute(int min, int max) + { + this.min = min; + this.max = max; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Object Drawers/IntSliderAttribute.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Object Drawers/IntSliderAttribute.cs.meta new file mode 100644 index 000000000..595d38828 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Object Drawers/IntSliderAttribute.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2373bfe29d0e5bc47b88a46226aa6a61 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Object Drawers/IntSliderAttribute.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks.meta new file mode 100644 index 000000000..1cc0009c4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2cd36de769e955742bf9b7cf79fb671f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions.meta new file mode 100644 index 000000000..614c16ef6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 91c6a439cec3003498369e01301ee57a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/BehaviorTreeReference.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/BehaviorTreeReference.cs new file mode 100644 index 000000000..54ab44e26 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/BehaviorTreeReference.cs @@ -0,0 +1,17 @@ + + +namespace BehaviorDesigner.Runtime.Tasks +{ + // Wrapper class for the Behavior Reference task. The Behavior Tree Reference task allows you to run another behavior tree within the current behavior tree. + // One use for this task is if you have an unit that plays a series of tasks to attack. You may want the unit to attack at different points within + // the behavior tree, and you want that attack to always be the same. Instead of copying and pasting the same tasks over and over you can just use + // an external behavior and then the tasks are always guaranteed to be the same. This example is demonstrated in the RTS sample project located at + // https://www.opsive.com/downloads/?pid=803. + [TaskDescription("Behavior Tree Reference allows you to run another behavior tree within the current behavior tree.")] + [HelpURL("https://www.opsive.com/support/documentation/behavior-designer/external-behavior-trees/")] + [TaskIcon("BehaviorTreeReferenceIcon.png")] + public class BehaviorTreeReference : BehaviorReference + { + // intentionally left blank - subclass of BehaviorReference + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/BehaviorTreeReference.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/BehaviorTreeReference.cs.meta new file mode 100644 index 000000000..efb268f18 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/BehaviorTreeReference.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: af7b6fcbc7258f34aad1bb82b5b3fdc8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/BehaviorTreeReference.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Idle.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Idle.cs new file mode 100644 index 000000000..039104ae7 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Idle.cs @@ -0,0 +1,14 @@ + + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Returns a TaskStatus of running. Will only stop when interrupted or a conditional abort is triggered.")] + [TaskIcon("{SkinColor}IdleIcon.png")] + public class Idle : Action + { + public override TaskStatus OnUpdate() + { + return TaskStatus.Running; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Idle.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Idle.cs.meta new file mode 100644 index 000000000..8d2e35687 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Idle.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 759252a4ffada80419ef06ce1c625246 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/Idle.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Log.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Log.cs new file mode 100644 index 000000000..1e05caf0b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Log.cs @@ -0,0 +1,35 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Log is a simple task which will output the specified text and return success. It can be used for debugging.")] + [TaskIcon("{SkinColor}LogIcon.png")] + public class Log : Action + { + [Tooltip("Text to output to the log")] + public SharedString text; + [Tooltip("Is this text an error?")] + public SharedBool logError; + [Tooltip("Should the time be included in the log message?")] + public SharedBool logTime; + + public override TaskStatus OnUpdate() + { + // Log the text and return success + if (logError.Value) { + Debug.LogError(logTime.Value ? string.Format("{0}: {1}", Time.time, text) : text); + } else { + Debug.Log(logTime.Value ? string.Format("{0}: {1}",Time.time, text) : text); + } + return TaskStatus.Success; + } + + public override void OnReset() + { + // Reset the properties back to their original values + text = ""; + logError = false; + logTime = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Log.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Log.cs.meta new file mode 100644 index 000000000..c16c165cd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Log.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: d53794347878c7c479da37533dce2024 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/Log.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/PerformInterruption.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/PerformInterruption.cs new file mode 100644 index 000000000..861345fa5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/PerformInterruption.cs @@ -0,0 +1,28 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Perform the actual interruption. This will immediately stop the specified tasks from running and will return success or failure depending on the value of interrupt success.")] + [TaskIcon("{SkinColor}PerformInterruptionIcon.png")] + public class PerformInterruption : Action + { + [Tooltip("The list of tasks to interrupt. Can be any number of tasks")] + public Interrupt[] interruptTasks; + [Tooltip("When we interrupt the task should we return a task status of success?")] + public SharedBool interruptSuccess; + + public override TaskStatus OnUpdate() + { + // Loop through all of the tasks and fire an interruption. Once complete return success. + for (int i = 0; i < interruptTasks.Length; ++i) { + interruptTasks[i].DoInterrupt(interruptSuccess.Value ? TaskStatus.Success : TaskStatus.Failure); + } + return TaskStatus.Success; + } + + public override void OnReset() + { + // Reset the properties back to their original values. + interruptTasks = null; + interruptSuccess = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/PerformInterruption.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/PerformInterruption.cs.meta new file mode 100644 index 000000000..434473309 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/PerformInterruption.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 72d2d6051b23e86468e2f715f044dad8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/PerformInterruption.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection.meta new file mode 100644 index 000000000..83432cf7c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7bbf15f7023452341aebe68861a3aabc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/GetFieldValue.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/GetFieldValue.cs new file mode 100644 index 000000000..72a4f4e15 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/GetFieldValue.cs @@ -0,0 +1,57 @@ +using UnityEngine; +using System; +using System.Reflection; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Gets the value from the field specified. Returns success if the field was retrieved.")] + [TaskCategory("Reflection")] + [TaskIcon("{SkinColor}ReflectionIcon.png")] + public class GetFieldValue : Action + { + [Tooltip("The GameObject to get the field on")] + public SharedGameObject targetGameObject; + [Tooltip("The component to get the field on")] + public SharedString componentName; + [Tooltip("The name of the field")] + public SharedString fieldName; + [Tooltip("The value of the field")] + [RequiredField] + public SharedVariable fieldValue; + + public override TaskStatus OnUpdate() + { + if (fieldValue == null) { + Debug.LogWarning("Unable to get field - field value is null"); + return TaskStatus.Failure; + } + + var type = TaskUtility.GetTypeWithinAssembly(componentName.Value); + if (type == null) { + Debug.LogWarning("Unable to get field - type is null"); + return TaskStatus.Failure; + } + + var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type); + if (component == null) { + Debug.LogWarning("Unable to get the field with component " + componentName.Value); + return TaskStatus.Failure; + } + + // If you are receiving a compiler error on the Windows Store platform see this topic: + // https://www.opsive.com/support/documentation/behavior-designer/installation/ + var field = component.GetType().GetField(fieldName.Value); + fieldValue.SetValue(field.GetValue(component)); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + componentName = null; + fieldName = null; + fieldValue = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/GetFieldValue.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/GetFieldValue.cs.meta new file mode 100644 index 000000000..d8a833582 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/GetFieldValue.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: bc317dd7feb2085499edb0d0c4604640 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/GetFieldValue.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/GetPropertyValue.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/GetPropertyValue.cs new file mode 100644 index 000000000..82669b2ba --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/GetPropertyValue.cs @@ -0,0 +1,57 @@ +using UnityEngine; +using System; +using System.Reflection; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Gets the value from the property specified. Returns success if the property was retrieved.")] + [TaskCategory("Reflection")] + [TaskIcon("{SkinColor}ReflectionIcon.png")] + public class GetPropertyValue : Action + { + [Tooltip("The GameObject to get the property of")] + public SharedGameObject targetGameObject; + [Tooltip("The component to get the property of")] + public SharedString componentName; + [Tooltip("The name of the property")] + public SharedString propertyName; + [Tooltip("The value of the property")] + [RequiredField] + public SharedVariable propertyValue; + + public override TaskStatus OnUpdate() + { + if (propertyValue == null) { + Debug.LogWarning("Unable to get property - property value is null"); + return TaskStatus.Failure; + } + + var type = TaskUtility.GetTypeWithinAssembly(componentName.Value); + if (type == null) { + Debug.LogWarning("Unable to get property - type is null"); + return TaskStatus.Failure; + } + + var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type); + if (component == null) { + Debug.LogWarning("Unable to get the property with component " + componentName.Value); + return TaskStatus.Failure; + } + + // If you are receiving a compiler error on the Windows Store platform see this topic: + // https://www.opsive.com/support/documentation/behavior-designer/installation/ + var property = component.GetType().GetProperty(propertyName.Value); + propertyValue.SetValue(property.GetValue(component, null)); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + componentName = null; + propertyName = null; + propertyValue = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/GetPropertyValue.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/GetPropertyValue.cs.meta new file mode 100644 index 000000000..886625639 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/GetPropertyValue.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: dda9c9b7c6ff2ee4f95a2e208cddae64 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/GetPropertyValue.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/InvokeMethod.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/InvokeMethod.cs new file mode 100644 index 000000000..83575237b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/InvokeMethod.cs @@ -0,0 +1,84 @@ +using UnityEngine; +using System; +using System.Collections.Generic; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Invokes the specified method with the specified parameters. Can optionally store the return value. Returns success if the method was invoked.")] + [TaskCategory("Reflection")] + [TaskIcon("{SkinColor}ReflectionIcon.png")] + public class InvokeMethod : Action + { + [Tooltip("The GameObject to invoke the method on")] + public SharedGameObject targetGameObject; + [Tooltip("The component to invoke the method on")] + public SharedString componentName; + [Tooltip("The name of the method")] + public SharedString methodName; + [Tooltip("The first parameter of the method")] + public SharedVariable parameter1; + [Tooltip("The second parameter of the method")] + public SharedVariable parameter2; + [Tooltip("The third parameter of the method")] + public SharedVariable parameter3; + [Tooltip("The fourth parameter of the method")] + public SharedVariable parameter4; + [Tooltip("Store the result of the invoke call")] + public SharedVariable storeResult; + + public override TaskStatus OnUpdate() + { + var type = TaskUtility.GetTypeWithinAssembly(componentName.Value); + if (type == null) { + Debug.LogWarning("Unable to invoke - type is null"); + return TaskStatus.Failure; + } + + var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type); + if (component == null) { + Debug.LogWarning("Unable to invoke method with component " + componentName.Value); + return TaskStatus.Failure; + } + + var parameterList = new List(); + var parameterTypeList = new List(); + SharedVariable sharedVariable = null; + for (int i = 0; i < 4; ++i) { + var parameterField = GetType().GetField("parameter" + (i + 1)); + if ((sharedVariable = parameterField.GetValue(this) as SharedVariable) != null) { + parameterList.Add(sharedVariable.GetValue()); + parameterTypeList.Add(sharedVariable.GetType().GetProperty("Value").PropertyType); + } else { + break; + } + } + // If you are receiving a compiler error on the Windows Store platform see this topic: + // https://www.opsive.com/support/documentation/behavior-designer/installation/ + var methodInfo = component.GetType().GetMethod(methodName.Value, parameterTypeList.ToArray()); + + if (methodInfo == null) { + Debug.LogWarning("Unable to invoke method " + methodName.Value + " on component " + componentName.Value); + return TaskStatus.Failure; + } + + var result = methodInfo.Invoke(component, parameterList.ToArray()); + if (storeResult != null) { + storeResult.SetValue(result); + } + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + componentName = null; + methodName = null; + parameter1 = null; + parameter2 = null; + parameter3 = null; + parameter4 = null; + storeResult = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/InvokeMethod.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/InvokeMethod.cs.meta new file mode 100644 index 000000000..b773223e4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/InvokeMethod.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 359bd67578f53034ab2eb00e7696d317 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/InvokeMethod.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/SetFieldValue.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/SetFieldValue.cs new file mode 100644 index 000000000..8b8337ea9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/SetFieldValue.cs @@ -0,0 +1,56 @@ +using UnityEngine; +using System; +using System.Reflection; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Sets the field to the value specified. Returns success if the field was set.")] + [TaskCategory("Reflection")] + [TaskIcon("{SkinColor}ReflectionIcon.png")] + public class SetFieldValue : Action + { + [Tooltip("The GameObject to set the field on")] + public SharedGameObject targetGameObject; + [Tooltip("The component to set the field on")] + public SharedString componentName; + [Tooltip("The name of the field")] + public SharedString fieldName; + [Tooltip("The value to set")] + public SharedVariable fieldValue; + + public override TaskStatus OnUpdate() + { + if (fieldValue == null) { + Debug.LogWarning("Unable to get field - field value is null"); + return TaskStatus.Failure; + } + + var type = TaskUtility.GetTypeWithinAssembly(componentName.Value); + if (type == null) { + Debug.LogWarning("Unable to set field - type is null"); + return TaskStatus.Failure; + } + + var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type); + if (component == null) { + Debug.LogWarning("Unable to set the field with component " + componentName.Value); + return TaskStatus.Failure; + } + + // If you are receiving a compiler error on the Windows Store platform see this topic: + // https://www.opsive.com/support/documentation/behavior-designer/installation/ + var field = component.GetType().GetField(fieldName.Value); + field.SetValue(component, fieldValue.GetValue()); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + componentName = null; + fieldName = null; + fieldValue = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/SetFieldValue.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/SetFieldValue.cs.meta new file mode 100644 index 000000000..e070f8d90 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/SetFieldValue.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 21e389787213ba24ab1a6817def634ae +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/SetFieldValue.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/SetPropertyValue.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/SetPropertyValue.cs new file mode 100644 index 000000000..ab0cc1ddd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/SetPropertyValue.cs @@ -0,0 +1,56 @@ +using UnityEngine; +using System; +using System.Reflection; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Sets the property to the value specified. Returns success if the property was set.")] + [TaskCategory("Reflection")] + [TaskIcon("{SkinColor}ReflectionIcon.png")] + public class SetPropertyValue : Action + { + [Tooltip("The GameObject to set the property on")] + public SharedGameObject targetGameObject; + [Tooltip("The component to set the property on")] + public SharedString componentName; + [Tooltip("The name of the property")] + public SharedString propertyName; + [Tooltip("The value to set")] + public SharedVariable propertyValue; + + public override TaskStatus OnUpdate() + { + if (propertyValue == null) { + Debug.LogWarning("Unable to get field - field value is null"); + return TaskStatus.Failure; + } + + var type = TaskUtility.GetTypeWithinAssembly(componentName.Value); + if (type == null) { + Debug.LogWarning("Unable to set property - type is null"); + return TaskStatus.Failure; + } + + var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type); + if (component == null) { + Debug.LogWarning("Unable to set the property with component " + componentName.Value); + return TaskStatus.Failure; + } + + // If you are receiving a compiler error on the Windows Store platform see this topic: + // https://www.opsive.com/support/documentation/behavior-designer/installation/ + var property = component.GetType().GetProperty(propertyName.Value); + property.SetValue(component, propertyValue.GetValue(), null); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + componentName = null; + propertyName = null; + propertyValue = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/SetPropertyValue.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/SetPropertyValue.cs.meta new file mode 100644 index 000000000..c05d1f543 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/SetPropertyValue.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d98b13b7ae4b36b4092b439731466d9b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/SetPropertyValue.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/RestartBehaviorTree.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/RestartBehaviorTree.cs new file mode 100644 index 000000000..2e9bbb600 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/RestartBehaviorTree.cs @@ -0,0 +1,55 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Restarts a behavior tree, returns success after it has been restarted.")] + [TaskIcon("{SkinColor}RestartBehaviorTreeIcon.png")] + public class RestartBehaviorTree : Action + { + [Tooltip("The GameObject of the behavior tree that should be restarted. If null use the current behavior")] + public SharedGameObject behaviorGameObject; + [Tooltip("The group of the behavior tree that should be restarted")] + public SharedInt group; + + private Behavior behavior; + + public override void OnAwake() + { + var behaviorTrees = GetDefaultGameObject(behaviorGameObject.Value).GetComponents(); + if (behaviorTrees.Length == 1) { + behavior = behaviorTrees[0]; + } else if (behaviorTrees.Length > 1) { + for (int i = 0; i < behaviorTrees.Length; ++i) { + if (behaviorTrees[i].Group == group.Value) { + behavior = behaviorTrees[i]; + break; + } + } + // If the group can't be found then use the first behavior tree + if (behavior == null) { + behavior = behaviorTrees[0]; + } + } + } + + public override TaskStatus OnUpdate() + { + if (behavior == null) { + return TaskStatus.Failure; + } + + // Stop the behavior tree + behavior.DisableBehavior(); + // Start the behavior tree back up + behavior.EnableBehavior(); + // Return success + return TaskStatus.Success; + } + + public override void OnReset() + { + // Reset the properties back to their original values. + behavior = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/RestartBehaviorTree.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/RestartBehaviorTree.cs.meta new file mode 100644 index 000000000..9417a4dc4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/RestartBehaviorTree.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2765e7ece98046542880a1249b87e096 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/RestartBehaviorTree.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/SendEvent.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/SendEvent.cs new file mode 100644 index 000000000..6af8ac4ef --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/SendEvent.cs @@ -0,0 +1,73 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Sends an event to the behavior tree, returns success after sending the event.")] + [HelpURL("https://www.opsive.com/support/documentation/behavior-designer/events/")] + [TaskIcon("{SkinColor}SendEventIcon.png")] + public class SendEvent : Action + { + [Tooltip("The GameObject of the behavior tree that should have the event sent to it. If null use the current behavior")] + public SharedGameObject targetGameObject; + [Tooltip("The event to send")] + public SharedString eventName; + [Tooltip("The group of the behavior tree that the event should be sent to")] + public SharedInt group; + [Tooltip("Optionally specify a first argument to send")] + [SharedRequired] + public SharedVariable argument1; + [Tooltip("Optionally specify a second argument to send")] + [SharedRequired] + public SharedVariable argument2; + [Tooltip("Optionally specify a third argument to send")] + [SharedRequired] + public SharedVariable argument3; + + private BehaviorTree behaviorTree; + + public override void OnStart() + { + var behaviorTrees = GetDefaultGameObject(targetGameObject.Value).GetComponents(); + if (behaviorTrees.Length == 1) { + behaviorTree = behaviorTrees[0]; + } else if (behaviorTrees.Length > 1) { + for (int i = 0; i < behaviorTrees.Length; ++i) { + if (behaviorTrees[i].Group == group.Value) { + behaviorTree = behaviorTrees[i]; + break; + } + } + // If the group can't be found then use the first behavior tree + if (behaviorTree == null) { + behaviorTree = behaviorTrees[0]; + } + } + } + + public override TaskStatus OnUpdate() + { + // Send the event and return success + if (argument1 == null || argument1.IsNone) { + behaviorTree.SendEvent(eventName.Value); + } else { + if (argument2 == null || argument2.IsNone) { + behaviorTree.SendEvent(eventName.Value, argument1.GetValue()); + } else { + if (argument3 == null || argument3.IsNone) { + behaviorTree.SendEvent(eventName.Value, argument1.GetValue(), argument2.GetValue()); + } else { + behaviorTree.SendEvent(eventName.Value, argument1.GetValue(), argument2.GetValue(), argument3.GetValue()); + } + } + } + return TaskStatus.Success; + } + + public override void OnReset() + { + // Reset the properties back to their original values + targetGameObject = null; + eventName = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/SendEvent.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/SendEvent.cs.meta new file mode 100644 index 000000000..fe3cea3a1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/SendEvent.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 53b90428a37913c40b6d415ced4e12f9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/SendEvent.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StackedAction.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StackedAction.cs new file mode 100644 index 000000000..3d6f4f48c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StackedAction.cs @@ -0,0 +1,270 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Allows multiple action tasks to be added to a single node.")] + [TaskIcon("{SkinColor}StackedActionIcon.png")] + public class StackedAction : Action + { + [InspectTask] + public Action[] actions; + public enum ComparisonType + { + Sequence, + Selector + } + [Tooltip("Specifies if the tasks should be traversed with an AND (Sequence) or an OR (Selector).")] + public ComparisonType comparisonType; + [Tooltip("Should the tasks be labeled within the graph?")] + public bool graphLabel; + + public override void OnAwake() + { + if (actions == null) { + return; + } + + for (int i = 0; i < actions.Length; ++i) { + if (actions[i] == null) { + continue; + } + + actions[i].GameObject = gameObject; + actions[i].Transform = transform; + actions[i].Owner = Owner; +#if UNITY_EDITOR || DLL_RELEASE || DLL_DEBUG + actions[i].NodeData = new NodeData(); +#endif + actions[i].OnAwake(); + } + } + + public override void OnStart() + { + if (actions == null) { + return; + } + + for (int i = 0; i < actions.Length; ++i) { + if (actions[i] == null) { + continue; + } + actions[i].OnStart(); + } + } + + public override TaskStatus OnUpdate() + { + if (actions == null) { + return TaskStatus.Failure; + } + + for (int i = 0; i < actions.Length; ++i) { + if (actions[i] == null) { + continue; + } + var executionStatus = actions[i].OnUpdate(); +#if UNITY_EDITOR || DLL_RELEASE || DLL_DEBUG + actions[i].NodeData.ExecutionStatus = executionStatus; + if (actions[i].NodeData.ExecutionStatus == TaskStatus.Running) { + Debug.LogWarning("Warning: The action task returned a status of running when action tasks should only return success or failure."); + } +#endif + if (comparisonType == ComparisonType.Sequence && executionStatus == TaskStatus.Failure) { + return TaskStatus.Failure; + } else if (comparisonType == ComparisonType.Selector && executionStatus == TaskStatus.Success) { + return TaskStatus.Success; + } + } + return comparisonType == ComparisonType.Sequence ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnFixedUpdate() + { + if (actions == null) { + return; + } + + for (int i = 0; i < actions.Length; ++i) { + if (actions[i] == null) { + continue; + } + actions[i].OnFixedUpdate(); + } + } + + public override void OnLateUpdate() + { + if (actions == null) { + return; + } + + for (int i = 0; i < actions.Length; ++i) { + if (actions[i] == null) { + continue; + } + actions[i].OnLateUpdate(); + } + } + + public override void OnEnd() + { + if (actions == null) { + return; + } + + for (int i = 0; i < actions.Length; ++i) { + if (actions[i] == null) { + continue; + } + actions[i].OnEnd(); + } + } + + public override void OnTriggerEnter(Collider other) + { + if (actions == null) { + return; + } + + for (int i = 0; i < actions.Length; ++i) { + if (actions[i] == null) { + continue; + } + actions[i].OnTriggerEnter(other); + } + } + + public override void OnTriggerEnter2D(Collider2D other) + { + if (actions == null) { + return; + } + + for (int i = 0; i < actions.Length; ++i) { + if (actions[i] == null) { + continue; + } + actions[i].OnTriggerEnter2D(other); + } + } + + public override void OnTriggerExit(Collider other) + { + if (actions == null) { + return; + } + + for (int i = 0; i < actions.Length; ++i) { + if (actions[i] == null) { + continue; + } + actions[i].OnTriggerExit(other); + } + } + + public override void OnTriggerExit2D(Collider2D other) + { + if (actions == null) { + return; + } + + for (int i = 0; i < actions.Length; ++i) { + if (actions[i] == null) { + continue; + } + actions[i].OnTriggerExit2D(other); + } + } + + public override void OnCollisionEnter(Collision collision) + { + if (actions == null) { + return; + } + + for (int i = 0; i < actions.Length; ++i) { + if (actions[i] == null) { + continue; + } + actions[i].OnCollisionEnter(collision); + } + } + + public override void OnCollisionEnter2D(Collision2D collision) + { + if (actions == null) { + return; + } + + for (int i = 0; i < actions.Length; ++i) { + if (actions[i] == null) { + continue; + } + actions[i].OnCollisionEnter2D(collision); + } + } + + public override void OnCollisionExit(Collision collision) + { + if (actions == null) { + return; + } + + for (int i = 0; i < actions.Length; ++i) { + if (actions[i] == null) { + continue; + } + actions[i].OnCollisionExit(collision); + } + } + + public override void OnCollisionExit2D(Collision2D collision) + { + if (actions == null) { + return; + } + + for (int i = 0; i < actions.Length; ++i) { + if (actions[i] == null) { + continue; + } + actions[i].OnCollisionExit2D(collision); + } + } + + public override string OnDrawNodeText() + { + if (actions == null || !graphLabel) { + return string.Empty; + } + + var text = string.Empty; + for (int i = 0; i < actions.Length; ++i) { + if (actions[i] == null) { + continue; + } + if (!string.IsNullOrEmpty(text)) { + text += "\n"; + } + text += actions[i].GetType().Name; + } + + return text; + } + + public override void OnReset() + { + if (actions == null) { + return; + } + + for (int i = 0; i < actions.Length; ++i) { + if (actions[i] == null) { + continue; + } + actions[i].OnReset(); + } + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StackedAction.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StackedAction.cs.meta new file mode 100644 index 000000000..f6aa8d378 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StackedAction.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 60f3f340bd02a8a4c84749a903c731da +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/StackedAction.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StartBehaviorTree.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StartBehaviorTree.cs new file mode 100644 index 000000000..8969ad451 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StartBehaviorTree.cs @@ -0,0 +1,91 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Start a new behavior tree and return success after it has been started.")] + [TaskIcon("{SkinColor}StartBehaviorTreeIcon.png")] + public class StartBehaviorTree : Action + { + [Tooltip("The GameObject of the behavior tree that should be started. If null use the current behavior")] + public SharedGameObject behaviorGameObject; + [Tooltip("The group of the behavior tree that should be started")] + public SharedInt group; + [Tooltip("Should this task wait for the behavior tree to complete?")] + public SharedBool waitForCompletion = false; + [Tooltip("Should the variables be synchronized?")] + public SharedBool synchronizeVariables; + + private bool behaviorComplete; + private Behavior behavior; + + public override void OnStart() + { + var behaviorTrees = GetDefaultGameObject(behaviorGameObject.Value).GetComponents(); + if (behaviorTrees.Length == 1) { + behavior = behaviorTrees[0]; + } else if (behaviorTrees.Length > 1) { + for (int i = 0; i < behaviorTrees.Length; ++i) { + if (behaviorTrees[i].Group == group.Value) { + behavior = behaviorTrees[i]; + break; + } + } + // If the group can't be found then use the first behavior tree + if (behavior == null) { + behavior = behaviorTrees[0]; + } + } + + if (behavior != null) { + var variables = Owner.GetAllVariables(); + if (variables != null && synchronizeVariables.Value) { + for (int i = 0; i < variables.Count; ++i) { + behavior.SetVariableValue(variables[i].Name, variables[i]); + } + } + + behavior.EnableBehavior(); + + if (waitForCompletion.Value) { + behaviorComplete = false; + behavior.OnBehaviorEnd += BehaviorEnded; + } + } + } + + public override TaskStatus OnUpdate() + { + if (behavior == null) { + return TaskStatus.Failure; + } + + // Return a status of running if we are waiting for the behavior tree to end and it hasn't ended yet + if (waitForCompletion.Value && !behaviorComplete) { + return TaskStatus.Running; + } + + return TaskStatus.Success; + } + + private void BehaviorEnded(Behavior behavior) + { + behaviorComplete = true; + } + + public override void OnEnd() + { + if (behavior != null && waitForCompletion.Value) { + behavior.OnBehaviorEnd -= BehaviorEnded; + } + } + + public override void OnReset() + { + // Reset the properties back to their original values. + behaviorGameObject = null; + group = 0; + waitForCompletion = false; + synchronizeVariables = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StartBehaviorTree.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StartBehaviorTree.cs.meta new file mode 100644 index 000000000..364a4a674 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StartBehaviorTree.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: bc3d67c80371297439385b30f4be506c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/StartBehaviorTree.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StopBehaviorTree.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StopBehaviorTree.cs new file mode 100644 index 000000000..b91a0e3f9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StopBehaviorTree.cs @@ -0,0 +1,56 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Pause or disable a behavior tree and return success after it has been stopped.")] + [TaskIcon("{SkinColor}StopBehaviorTreeIcon.png")] + public class StopBehaviorTree : Action + { + [Tooltip("The GameObject of the behavior tree that should be stopped. If null use the current behavior")] + public SharedGameObject behaviorGameObject; + [Tooltip("The group of the behavior tree that should be stopped")] + public SharedInt group; + [Tooltip("Should the behavior be paused or completely disabled")] + public SharedBool pauseBehavior = false; + + private Behavior behavior; + + public override void OnStart() + { + var behaviorTrees = GetDefaultGameObject(behaviorGameObject.Value).GetComponents(); + if (behaviorTrees.Length == 1) { + behavior = behaviorTrees[0]; + } else if (behaviorTrees.Length > 1) { + for (int i = 0; i < behaviorTrees.Length; ++i) { + if (behaviorTrees[i].Group == group.Value) { + behavior = behaviorTrees[i]; + break; + } + } + // If the group can't be found then use the first behavior tree + if (behavior == null) { + behavior = behaviorTrees[0]; + } + } + } + + public override TaskStatus OnUpdate() + { + if (behavior == null) { + return TaskStatus.Failure; + } + + // Start the behavior and return success. + behavior.DisableBehavior(pauseBehavior.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + // Reset the properties back to their original values + behaviorGameObject = null; + group = 0; + pauseBehavior = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StopBehaviorTree.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StopBehaviorTree.cs.meta new file mode 100644 index 000000000..71ab53dbf --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/StopBehaviorTree.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 130afc7e6aa6e0c4aba29097334aa66b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/StopBehaviorTree.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Wait.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Wait.cs new file mode 100644 index 000000000..da0ae3879 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Wait.cs @@ -0,0 +1,66 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Wait a specified amount of time. The task will return running until the task is done waiting. It will return success after the wait time has elapsed.")] + [TaskIcon("{SkinColor}WaitIcon.png")] + public class Wait : Action + { + [Tooltip("The amount of time to wait")] + public SharedFloat waitTime = 1; + [Tooltip("Should the wait be randomized?")] + public SharedBool randomWait = false; + [Tooltip("The minimum wait time if random wait is enabled")] + public SharedFloat randomWaitMin = 1; + [Tooltip("The maximum wait time if random wait is enabled")] + public SharedFloat randomWaitMax = 1; + + // The time to wait + private float waitDuration; + // The time that the task started to wait. + private float startTime; + // Remember the time that the task is paused so the time paused doesn't contribute to the wait time. + private float pauseTime; + + public override void OnStart() + { + // Remember the start time. + startTime = Time.time; + if (randomWait.Value) { + waitDuration = Random.Range(randomWaitMin.Value, randomWaitMax.Value); + } else { + waitDuration = waitTime.Value; + } + } + + public override TaskStatus OnUpdate() + { + // The task is done waiting if the time waitDuration has elapsed since the task was started. + if (startTime + waitDuration < Time.time) { + return TaskStatus.Success; + } + // Otherwise we are still waiting. + return TaskStatus.Running; + } + + public override void OnPause(bool paused) + { + if (paused) { + // Remember the time that the behavior was paused. + pauseTime = Time.time; + } else { + // Add the difference between Time.time and pauseTime to figure out a new start time. + startTime += (Time.time - pauseTime); + } + } + + public override void OnReset() + { + // Reset the public properties back to their original values + waitTime = 1; + randomWait = false; + randomWaitMin = 1; + randomWaitMax = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Wait.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Wait.cs.meta new file mode 100644 index 000000000..d3ee03d04 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Actions/Wait.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 67824d2e00531d84db9973773e4426e9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/Wait.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites.meta new file mode 100644 index 000000000..707a8f693 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 02c91ef526a3f8a41b5df4402d7c783f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Parallel.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Parallel.cs new file mode 100644 index 000000000..b8525e666 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Parallel.cs @@ -0,0 +1,86 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Similar to the sequence task, the parallel task will run each child task until a child task returns failure. " + + "The difference is that the parallel task will run all of its children tasks simultaneously versus running each task one at a time. " + + "Like the sequence class, the parallel task will return success once all of its children tasks have return success. " + + "If one tasks returns failure the parallel task will end all of the child tasks and return failure.")] + [TaskIcon("{SkinColor}ParallelIcon.png")] + public class Parallel : Composite + { + // The index of the child that is currently running or is about to run. + private int currentChildIndex; + // The task status of every child task. + private TaskStatus[] executionStatus; + + public override void OnAwake() + { + // Create a new task status array that will hold the execution status of all of the children tasks. + executionStatus = new TaskStatus[children.Count]; + } + + public override void OnChildStarted(int childIndex) + { + // One of the children has started to run. Increment the child index and set the current task status of that child to running. + currentChildIndex++; + executionStatus[childIndex] = TaskStatus.Running; + } + + public override bool CanRunParallelChildren() + { + // This task can run parallel children. + return true; + } + + public override int CurrentChildIndex() + { + return currentChildIndex; + } + + public override bool CanExecute() + { + // We can continue executing if we have more children that haven't been started yet. + return currentChildIndex < children.Count; + } + + public override void OnChildExecuted(int childIndex, TaskStatus childStatus) + { + // One of the children has finished running. Set the task status. + executionStatus[childIndex] = childStatus; + } + + public override TaskStatus OverrideStatus(TaskStatus status) + { + // Assume all of the children have finished executing. Loop through the execution status of every child and check to see if any tasks are currently running + // or failed. If a task is still running then all of the children are not done executing and the parallel task should continue to return a task status of running. + // If a task failed then return failure. The Behavior Manager will stop all of the children tasks. If no child task is running or has failed then the parallel + // task succeeded and it will return success. + bool childrenComplete = true; + for (int i = 0; i < executionStatus.Length; ++i) { + if (executionStatus[i] == TaskStatus.Running) { + childrenComplete = false; + } else if (executionStatus[i] == TaskStatus.Failure) { + return TaskStatus.Failure; + } + } + return (childrenComplete ? TaskStatus.Success : TaskStatus.Running); + } + + public override void OnConditionalAbort(int childIndex) + { + // Start from the beginning on an abort + currentChildIndex = 0; + for (int i = 0; i < executionStatus.Length; ++i) { + executionStatus[i] = TaskStatus.Inactive; + } + } + + public override void OnEnd() + { + // Reset the execution status and the child index back to their starting values. + for (int i = 0; i < executionStatus.Length; ++i) { + executionStatus[i] = TaskStatus.Inactive; + } + currentChildIndex = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Parallel.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Parallel.cs.meta new file mode 100644 index 000000000..f1f3ed462 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Parallel.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 4a7063721a0dbc04787bec1b0507f9ae +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Composites/Parallel.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/ParallelComplete.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/ParallelComplete.cs new file mode 100644 index 000000000..3acbadff7 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/ParallelComplete.cs @@ -0,0 +1,81 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Similar to the parallel selector task, except the parallel complete task will return the child status as soon as the child returns success or failure." + + "The child tasks are executed simultaneously.")] + [TaskIcon("{SkinColor}ParallelCompleteIcon.png")] + public class ParallelComplete : Composite + { + // The index of the child that is currently running or is about to run. + private int currentChildIndex; + // The task status of every child task. + private TaskStatus[] executionStatus; + + public override void OnAwake() + { + // Create a new task status array that will hold the execution status of all of the children tasks. + executionStatus = new TaskStatus[children.Count]; + } + + public override void OnChildStarted(int childIndex) + { + // One of the children has started to run. Increment the child index and set the current task status of that child to running. + currentChildIndex++; + executionStatus[childIndex] = TaskStatus.Running; + } + + public override bool CanRunParallelChildren() + { + // This task can run parallel children. + return true; + } + + public override int CurrentChildIndex() + { + return currentChildIndex; + } + + public override bool CanExecute() + { + // We can continue executing if we have more children that haven't been started yet. + return currentChildIndex < children.Count; + } + + public override void OnChildExecuted(int childIndex, TaskStatus childStatus) + { + // One of the children has finished running. Set the task status. + executionStatus[childIndex] = childStatus; + } + + public override void OnConditionalAbort(int childIndex) + { + // Start from the beginning on an abort + currentChildIndex = 0; + for (int i = 0; i < executionStatus.Length; ++i) { + executionStatus[i] = TaskStatus.Inactive; + } + } + + public override TaskStatus OverrideStatus(TaskStatus status) + { + if (currentChildIndex == 0) { + return TaskStatus.Success; + } + // Return the child task's status as soon as a child task returns success or failure. + for (int i = 0; i < currentChildIndex; ++i) { + if (executionStatus[i] == TaskStatus.Success || executionStatus[i] == TaskStatus.Failure) { + return executionStatus[i]; + } + } + return TaskStatus.Running; + } + + public override void OnEnd() + { + // Reset the execution status and the child index back to their starting values. + for (int i = 0; i < executionStatus.Length; ++i) { + executionStatus[i] = TaskStatus.Inactive; + } + currentChildIndex = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/ParallelComplete.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/ParallelComplete.cs.meta new file mode 100644 index 000000000..761a585ef --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/ParallelComplete.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: ef4b3eb51f6ede04bba3598677fe8531 +timeCreated: 1487379311 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Composites/ParallelComplete.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/ParallelSelector.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/ParallelSelector.cs new file mode 100644 index 000000000..b140033c0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/ParallelSelector.cs @@ -0,0 +1,86 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Similar to the selector task, the parallel selector task will return success as soon as a child task returns success. " + + "The difference is that the parallel task will run all of its children tasks simultaneously versus running each task one at a time. " + + "If one tasks returns success the parallel selector task will end all of the child tasks and return success. " + + "If every child task returns failure then the parallel selector task will return failure.")] + [TaskIcon("{SkinColor}ParallelSelectorIcon.png")] + public class ParallelSelector : Composite + { + // The index of the child that is currently running or is about to run. + private int currentChildIndex; + // The task status of every child task. + private TaskStatus[] executionStatus; + + public override void OnAwake() + { + // Create a new task status array that will hold the execution status of all of the children tasks. + executionStatus = new TaskStatus[children.Count]; + } + + public override void OnChildStarted(int childIndex) + { + // One of the children has started to run. Increment the child index and set the current task status of that child to running. + currentChildIndex++; + executionStatus[childIndex] = TaskStatus.Running; + } + + public override bool CanRunParallelChildren() + { + // This task can run parallel children. + return true; + } + + public override int CurrentChildIndex() + { + return currentChildIndex; + } + + public override bool CanExecute() + { + // We can continue executing if we have more children that haven't been started yet. + return currentChildIndex < children.Count; + } + + public override void OnChildExecuted(int childIndex, TaskStatus childStatus) + { + // One of the children has finished running. Set the task status. + executionStatus[childIndex] = childStatus; + } + + public override void OnConditionalAbort(int childIndex) + { + // Start from the beginning on an abort + currentChildIndex = 0; + for (int i = 0; i < executionStatus.Length; ++i) { + executionStatus[i] = TaskStatus.Inactive; + } + } + + public override TaskStatus OverrideStatus(TaskStatus status) + { + // Assume all of the children have finished executing. Loop through the execution status of every child and check to see if any tasks are currently running + // or succeeded. If a task is still running then all of the children are not done executing and the parallel selector task should continue to return a task status of running. + // If a task succeeded then return success. The Behavior Manager will stop all of the children tasks. If no child task is running or has succeeded then the parallel selector + // task failed and it will return failure. + bool childrenComplete = true; + for (int i = 0; i < executionStatus.Length; ++i) { + if (executionStatus[i] == TaskStatus.Running) { + childrenComplete = false; + } else if (executionStatus[i] == TaskStatus.Success) { + return TaskStatus.Success; + } + } + return (childrenComplete ? TaskStatus.Failure : TaskStatus.Running); + } + + public override void OnEnd() + { + // Reset the execution status and the child index back to their starting values. + for (int i = 0; i < executionStatus.Length; ++i) { + executionStatus[i] = TaskStatus.Inactive; + } + currentChildIndex = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/ParallelSelector.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/ParallelSelector.cs.meta new file mode 100644 index 000000000..fc94eda3a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/ParallelSelector.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 52e4e27ad95cedb41a3bc2c5f5ed0b54 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Composites/ParallelSelector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/PrioritySelector.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/PrioritySelector.cs new file mode 100644 index 000000000..ceda144db --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/PrioritySelector.cs @@ -0,0 +1,71 @@ +using System.Collections.Generic; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Similar to the selector task, the priority selector task will return success as soon as a child task returns success. " + + "Instead of running the tasks sequentially from left to right within the tree, the priority selector will ask the task what its priority is to determine the order. " + + "The higher priority tasks have a higher chance at being run first.")] + [TaskIcon("{SkinColor}PrioritySelectorIcon.png")] + public class PrioritySelector : Composite + { + // The index of the child that is currently running or is about to run. + private int currentChildIndex = 0; + // The task status of every child task. + private TaskStatus executionStatus = TaskStatus.Inactive; + // The order to run its children in. + private List childrenExecutionOrder = new List(); + + public override void OnStart() + { + // Make sure the list is empty before we add child indexes to it. + childrenExecutionOrder.Clear(); + + // Loop through each child task and determine its priority. The higher the priority the lower it goes within the list. The task with the highest + // priority will be first in the list and will be executed first. + for (int i = 0; i < children.Count; ++i) { + float priority = children[i].GetPriority(); + int insertIndex = childrenExecutionOrder.Count; + for (int j = 0; j < childrenExecutionOrder.Count; ++j) { + if (children[childrenExecutionOrder[j]].GetPriority() < priority) { + insertIndex = j; + break; + } + } + childrenExecutionOrder.Insert(insertIndex, i); + } + } + + public override int CurrentChildIndex() + { + // Use the execution order list in order to determine the current child index. + return childrenExecutionOrder[currentChildIndex]; + } + + public override bool CanExecute() + { + // We can continue to execuate as long as we have children that haven't been executed and no child has returned success. + return currentChildIndex < children.Count && executionStatus != TaskStatus.Success; + } + + public override void OnChildExecuted(TaskStatus childStatus) + { + // Increase the child index and update the execution status after a child has finished running. + currentChildIndex++; + executionStatus = childStatus; + } + + public override void OnConditionalAbort(int childIndex) + { + // Set the current child index to the index that caused the abort + currentChildIndex = childIndex; + executionStatus = TaskStatus.Inactive; + } + + public override void OnEnd() + { + // All of the children have run. Reset the variables back to their starting values. + executionStatus = TaskStatus.Inactive; + currentChildIndex = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/PrioritySelector.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/PrioritySelector.cs.meta new file mode 100644 index 000000000..63b6f44a3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/PrioritySelector.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 8b5aa86ad86e94f41841abd04bd96f2a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Composites/PrioritySelector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/RandomSelector.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/RandomSelector.cs new file mode 100644 index 000000000..e363d106a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/RandomSelector.cs @@ -0,0 +1,101 @@ +using UnityEngine; +using System.Collections.Generic; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Similar to the selector task, the random selector task will return success as soon as a child task returns success. " + + "The difference is that the random selector class will run its children in a random order. The selector task is deterministic " + + "in that it will always run the tasks from left to right within the tree. The random selector task shuffles the child tasks up and then begins " + + "execution in a random order. Other than that the random selector class is the same as the selector class. It will continue running tasks " + + "until a task completes successfully. If no child tasks return success then it will return failure.")] + [TaskIcon("{SkinColor}RandomSelectorIcon.png")] + public class RandomSelector : Composite + { + [Tooltip("Seed the random number generator to make things easier to debug")] + public int seed = 0; + [Tooltip("Do we want to use the seed?")] + public bool useSeed = false; + + // A list of indexes of every child task. This list is used by the Fischer-Yates shuffle algorithm. + private List childIndexList = new List(); + // The random child index execution order. + private Stack childrenExecutionOrder = new Stack(); + // The task status of the last child ran. + private TaskStatus executionStatus = TaskStatus.Inactive; + + public override void OnAwake() + { + // If specified, use the seed provided. + if (useSeed) { + Random.InitState(seed); + } + + // Add the index of each child to a list to make the Fischer-Yates shuffle possible. + childIndexList.Clear(); + for (int i = 0; i < children.Count; ++i) { + childIndexList.Add(i); + } + } + + public override void OnStart() + { + // Randomize the indecies + ShuffleChilden(); + } + + public override int CurrentChildIndex() + { + // Peek will return the index at the top of the stack. + return childrenExecutionOrder.Peek(); + } + + public override bool CanExecute() + { + // Continue exectuion if no task has return success and indexes still exist on the stack. + return childrenExecutionOrder.Count > 0 && executionStatus != TaskStatus.Success; + } + + public override void OnChildExecuted(TaskStatus childStatus) + { + // Pop the top index from the stack and set the execution status. + if (childrenExecutionOrder.Count > 0) { + childrenExecutionOrder.Pop(); + } + executionStatus = childStatus; + } + + public override void OnConditionalAbort(int childIndex) + { + // Start from the beginning on an abort + childrenExecutionOrder.Clear(); + executionStatus = TaskStatus.Inactive; + ShuffleChilden(); + } + + public override void OnEnd() + { + // All of the children have run. Reset the variables back to their starting values. + executionStatus = TaskStatus.Inactive; + childrenExecutionOrder.Clear(); + } + + public override void OnReset() + { + // Reset the public properties back to their original values + seed = 0; + useSeed = false; + } + + private void ShuffleChilden() + { + // Use Fischer-Yates shuffle to randomize the child index order. + for (int i = childIndexList.Count; i > 0; --i) { + int j = Random.Range(0, i); + int index = childIndexList[j]; + childrenExecutionOrder.Push(index); + childIndexList[j] = childIndexList[i - 1]; + childIndexList[i - 1] = index; + } + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/RandomSelector.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/RandomSelector.cs.meta new file mode 100644 index 000000000..c8c3763ca --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/RandomSelector.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 4952cbfc1e77be24b99e34c9acffc2a0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Composites/RandomSelector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/RandomSequence.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/RandomSequence.cs new file mode 100644 index 000000000..87719fa0e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/RandomSequence.cs @@ -0,0 +1,102 @@ +using UnityEngine; +using System.Collections.Generic; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Similar to the sequence task, the random sequence task will return success as soon as every child task returns success. " + + "The difference is that the random sequence class will run its children in a random order. The sequence task is deterministic " + + "in that it will always run the tasks from left to right within the tree. The random sequence task shuffles the child tasks up and then begins " + + "execution in a random order. Other than that the random sequence class is the same as the sequence class. It will stop running tasks " + + "as soon as a single task ends in failure. On a task failure it will stop executing all of the child tasks and return failure. " + + "If no child returns failure then it will return success.")] + [TaskIcon("{SkinColor}RandomSequenceIcon.png")] + public class RandomSequence : Composite + { + [Tooltip("Seed the random number generator to make things easier to debug")] + public int seed = 0; + [Tooltip("Do we want to use the seed?")] + public bool useSeed = false; + + // A list of indexes of every child task. This list is used by the Fischer-Yates shuffle algorithm. + private List childIndexList = new List(); + // The random child index execution order. + private Stack childrenExecutionOrder = new Stack(); + // The task status of the last child ran. + private TaskStatus executionStatus = TaskStatus.Inactive; + + public override void OnAwake() + { + // If specified, use the seed provided. + if (useSeed) { + Random.InitState(seed); + } + + // Add the index of each child to a list to make the Fischer-Yates shuffle possible. + childIndexList.Clear(); + for (int i = 0; i < children.Count; ++i) { + childIndexList.Add(i); + } + } + + public override void OnStart() + { + // Randomize the indecies + ShuffleChilden(); + } + + public override int CurrentChildIndex() + { + // Peek will return the index at the top of the stack. + return childrenExecutionOrder.Peek(); + } + + public override bool CanExecute() + { + // Continue exectuion if no task has return failure and indexes still exist on the stack. + return childrenExecutionOrder.Count > 0 && executionStatus != TaskStatus.Failure; + } + + public override void OnChildExecuted(TaskStatus childStatus) + { + // Pop the top index from the stack and set the execution status. + if (childrenExecutionOrder.Count > 0) { + childrenExecutionOrder.Pop(); + } + executionStatus = childStatus; + } + + public override void OnConditionalAbort(int childIndex) + { + // Start from the beginning on an abort + childrenExecutionOrder.Clear(); + executionStatus = TaskStatus.Inactive; + ShuffleChilden(); + } + + public override void OnEnd() + { + // All of the children have run. Reset the variables back to their starting values. + executionStatus = TaskStatus.Inactive; + childrenExecutionOrder.Clear(); + } + + public override void OnReset() + { + // Reset the public properties back to their original values + seed = 0; + useSeed = false; + } + + private void ShuffleChilden() + { + // Use Fischer-Yates shuffle to randomize the child index order. + for (int i = childIndexList.Count; i > 0; --i) { + int j = Random.Range(0, i); + int index = childIndexList[j]; + childrenExecutionOrder.Push(index); + childIndexList[j] = childIndexList[i - 1]; + childIndexList[i - 1] = index; + } + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/RandomSequence.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/RandomSequence.cs.meta new file mode 100644 index 000000000..4500fe1d8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/RandomSequence.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 11b102c97eb687b4a9ce1473a334c3dd +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Composites/RandomSequence.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Selector.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Selector.cs new file mode 100644 index 000000000..025097bfd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Selector.cs @@ -0,0 +1,45 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("The selector task is similar to an \"or\" operation. It will return success as soon as one of its child tasks return success. " + + "If a child task returns failure then it will sequentially run the next task. If no child task returns success then it will return failure.")] + [TaskIcon("{SkinColor}SelectorIcon.png")] + public class Selector : Composite + { + // The index of the child that is currently running or is about to run. + private int currentChildIndex = 0; + // The task status of the last child ran. + private TaskStatus executionStatus = TaskStatus.Inactive; + + public override int CurrentChildIndex() + { + return currentChildIndex; + } + + public override bool CanExecute() + { + // We can continue to execuate as long as we have children that haven't been executed and no child has returned success. + return currentChildIndex < children.Count && executionStatus != TaskStatus.Success; + } + + public override void OnChildExecuted(TaskStatus childStatus) + { + // Increase the child index and update the execution status after a child has finished running. + currentChildIndex++; + executionStatus = childStatus; + } + + public override void OnConditionalAbort(int childIndex) + { + // Set the current child index to the index that caused the abort + currentChildIndex = childIndex; + executionStatus = TaskStatus.Inactive; + } + + public override void OnEnd() + { + // All of the children have run. Reset the variables back to their starting values. + executionStatus = TaskStatus.Inactive; + currentChildIndex = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Selector.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Selector.cs.meta new file mode 100644 index 000000000..63d748b4f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Selector.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 7cb8dcec14880a443841212e6b595d4f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Composites/Selector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/SelectorEvaluator.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/SelectorEvaluator.cs new file mode 100644 index 000000000..eb3f64f13 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/SelectorEvaluator.cs @@ -0,0 +1,121 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("The selector evaluator is a selector task which reevaluates its children every tick. It will run the lowest priority child which returns a task status of running. " + + "This is done each tick. If a higher priority child is running and the next frame a lower priority child wants to run it will interrupt the higher priority child. " + + "The selector evaluator will return success as soon as the first child returns success otherwise it will keep trying higher priority children. This task mimics " + + "the conditional abort functionality except the child tasks don't always have to be conditional tasks.")] + [TaskIcon("{SkinColor}SelectorEvaluatorIcon.png")] + public class SelectorEvaluator : Composite + { + // The index of the child that is currently running or is about to run. + private int currentChildIndex = 0; + // The task status of the last child ran. + private TaskStatus executionStatus = TaskStatus.Inactive; + // The index of the child that was running before the tree started to be reevaluated. + private int storedCurrentChildIndex = -1; + // The task status of the last child ran before the tree started to be reevaluated. + private TaskStatus storedExecutionStatus = TaskStatus.Inactive; + + public override int CurrentChildIndex() + { + return currentChildIndex; + } + + public override void OnChildStarted(int childIndex) + { + // The children run sequentially so increment the index and set the status to running. + currentChildIndex++; + executionStatus = TaskStatus.Running; + } + + public override bool CanExecute() + { + // We can continue to execuate as long as we have children that haven't been executed and no child has returned success. + if (executionStatus == TaskStatus.Success || executionStatus == TaskStatus.Running) { + return false; + } + + // Used the storedCurrentChildIndex if reevaluating, otherwise the currentChildIndex + if (storedCurrentChildIndex != -1) { + return currentChildIndex < storedCurrentChildIndex - 1; + } + return currentChildIndex < children.Count; + } + + public override void OnChildExecuted(int childIndex, TaskStatus childStatus) + { + // A disabled task is the equivalent of the task failing for a selector evaluator. + if (childStatus == TaskStatus.Inactive && children[childIndex].Disabled) { + executionStatus = TaskStatus.Failure; + } + // The child status will be inactive immediately following an abort from OnReevaluationEnded. The status will be running if the + // child task is interrupted. Ignore the status for both of these. + if (childStatus != TaskStatus.Inactive && childStatus != TaskStatus.Running) { + executionStatus = childStatus; + } + } + + public override void OnConditionalAbort(int childIndex) + { + // Set the current child index to the index that caused the abort + currentChildIndex = childIndex; + executionStatus = TaskStatus.Inactive; + } + + public override void OnEnd() + { + // All of the children have run. Reset the variables back to their starting values. + executionStatus = TaskStatus.Inactive; + currentChildIndex = 0; + } + + public override TaskStatus OverrideStatus(TaskStatus status) + { + return executionStatus; + } + + // The selector evaluator task is a parallel task to allow the previous child to continue to run while the higher priority task is active. If the + // lower priority child can run then OnReevaluationEnded will interrupt the higher priority task. + public override bool CanRunParallelChildren() + { + return true; + } + + // Can reevaluate to allow the lower priority children the chance to rerun. + public override bool CanReevaluate() + { + return true; + } + + // The behavior tree wants to start reevaluating the tree. + public override bool OnReevaluationStarted() + { + // Cannot reevaluate if the task hasn't even started yet + if (executionStatus == TaskStatus.Inactive) { + return false; + } + + // Store the current index and execution status because it may need to be resumed. + storedCurrentChildIndex = currentChildIndex; + storedExecutionStatus = executionStatus; + currentChildIndex = 0; + executionStatus = TaskStatus.Inactive; + return true; + } + + // Reevaluation has ended. Determine if a task should be interrupted or resumed from the last index. + public override void OnReevaluationEnded(TaskStatus status) + { + // Interrupt the currently running index if a lower priority child returns a status of running or success. + if (executionStatus != TaskStatus.Failure && executionStatus != TaskStatus.Inactive) { + BehaviorManager.instance.Interrupt(Owner, children[storedCurrentChildIndex - 1], this, TaskStatus.Inactive); + } else { + // The lower priority children returned the same status so resume with the current child + currentChildIndex = storedCurrentChildIndex; + executionStatus = storedExecutionStatus; + } + storedCurrentChildIndex = -1; + storedExecutionStatus = TaskStatus.Inactive; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/SelectorEvaluator.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/SelectorEvaluator.cs.meta new file mode 100644 index 000000000..19c6954a1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/SelectorEvaluator.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 15b5d0aafd7d4f04f8332d33705ebd63 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Composites/SelectorEvaluator.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Sequence.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Sequence.cs new file mode 100644 index 000000000..ff4e286e8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Sequence.cs @@ -0,0 +1,45 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("The sequence task is similar to an \"and\" operation. It will return failure as soon as one of its child tasks return failure. " + + "If a child task returns success then it will sequentially run the next task. If all child tasks return success then it will return success.")] + [TaskIcon("{SkinColor}SequenceIcon.png")] + public class Sequence : Composite + { + // The index of the child that is currently running or is about to run. + private int currentChildIndex = 0; + // The task status of the last child ran. + private TaskStatus executionStatus = TaskStatus.Inactive; + + public override int CurrentChildIndex() + { + return currentChildIndex; + } + + public override bool CanExecute() + { + // We can continue to execuate as long as we have children that haven't been executed and no child has returned failure. + return currentChildIndex < children.Count && executionStatus != TaskStatus.Failure; + } + + public override void OnChildExecuted(TaskStatus childStatus) + { + // Increase the child index and update the execution status after a child has finished running. + currentChildIndex++; + executionStatus = childStatus; + } + + public override void OnConditionalAbort(int childIndex) + { + // Set the current child index to the index that caused the abort + currentChildIndex = childIndex; + executionStatus = TaskStatus.Inactive; + } + + public override void OnEnd() + { + // All of the children have run. Reset the variables back to their starting values. + executionStatus = TaskStatus.Inactive; + currentChildIndex = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Sequence.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Sequence.cs.meta new file mode 100644 index 000000000..16aaca34a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/Sequence.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: b7226608b64066c40a656d7260249fce +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Composites/Sequence.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/UtilitySelector.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/UtilitySelector.cs new file mode 100644 index 000000000..0273c9a0c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/UtilitySelector.cs @@ -0,0 +1,149 @@ +using System.Collections.Generic; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("The utility selector task evaluates the child tasks using Utility Theory AI. The child task can override the GetUtility method and return the utility value " + + "at that particular time. The task with the highest utility value will be selected and the existing running task will be aborted. The utility selector " + + "task reevaluates its children every tick.")] + [TaskIcon("{SkinColor}UtilitySelectorIcon.png")] + public class UtilitySelector : Composite + { + // The index of the child that is currently running or is about to run. + private int currentChildIndex = 0; + // The highest utility value + private float highestUtility; + // The task status of the last child ran. + private TaskStatus executionStatus = TaskStatus.Inactive; + // Is the task being reevaluated? + private bool reevaluating; + // A list of children that can execute. + private List availableChildren = new List(); + + public override void OnStart() + { + highestUtility = float.MinValue; + + // Loop through each child task and determine its utility. The task with the highest utility will run first. + availableChildren.Clear(); + for (int i = 0; i < children.Count; ++i) { + float utility = children[i].GetUtility(); + if (utility > highestUtility) { + highestUtility = utility; + currentChildIndex = i; + } + availableChildren.Add(i); + } + } + + public override int CurrentChildIndex() + { + // The currentChildIndex is the task with the highest utility. + return currentChildIndex; + } + + public override void OnChildStarted(int childIndex) + { + // The child has started - set the execution status. + executionStatus = TaskStatus.Running; + } + + public override bool CanExecute() + { + // Continue to execute new tasks until a task returns success or there are no more children left. If reevaluating then return false + // immediately because each task doesn't need to be reevaluted. + if (executionStatus == TaskStatus.Success || executionStatus == TaskStatus.Running || reevaluating) { + return false; + } + return availableChildren.Count > 0; + } + + public override void OnChildExecuted(int childIndex, TaskStatus childStatus) + { + // The child status will be inactive immediately following an abort from OnReevaluationEnded. The status will be running if the + // child task is interrupted. Ignore the status for both of these. + if (childStatus != TaskStatus.Inactive && childStatus != TaskStatus.Running) { + executionStatus = childStatus; + // If the execution status is failure then a new task needs to be selected. Remove the current task from the available children + // and select the next highest utility child. + if (executionStatus == TaskStatus.Failure) { + availableChildren.Remove(childIndex); + + highestUtility = float.MinValue; + for (int i = 0; i < availableChildren.Count; ++i) { + float utility = children[availableChildren[i]].GetUtility(); + if (utility > highestUtility) { + highestUtility = utility; + currentChildIndex = availableChildren[i]; + } + } + } + } + } + + public override void OnConditionalAbort(int childIndex) + { + // Set the current child index to the index that caused the abort + currentChildIndex = childIndex; + executionStatus = TaskStatus.Inactive; + } + + public override void OnEnd() + { + // All of the children have run. Reset the variables back to their starting values. + executionStatus = TaskStatus.Inactive; + currentChildIndex = 0; + } + + public override TaskStatus OverrideStatus(TaskStatus status) + { + return executionStatus; + } + + // The utility selector task is a parallel task to allow the task utility to be reevaluated. The higest utility task will always run. + public override bool CanRunParallelChildren() + { + return true; + } + + // Can reevaluate to allow the task utilities to be rerun. + public override bool CanReevaluate() + { + return true; + } + + // The behavior tree wants to start reevaluating the tree. + public override bool OnReevaluationStarted() + { + // Cannot reevaluate if the task hasn't even started yet + if (executionStatus == TaskStatus.Inactive) { + return false; + } + + reevaluating = true; + return true; + } + + // Determine if a task with a higher utility exists. + public override void OnReevaluationEnded(TaskStatus status) + { + reevaluating = false; + + // Loop through all of the available children and pick the task with the highest utility. + int prevChildIndex = currentChildIndex; + highestUtility = float.MinValue; + for (int i = 0; i < availableChildren.Count; ++i) { + float utility = children[availableChildren[i]].GetUtility(); + if (utility > highestUtility) { + highestUtility = utility; + currentChildIndex = availableChildren[i]; + } + } + + // If the index is different then the current child task should be aborted and the higher utility task should be run. + if (prevChildIndex != currentChildIndex) { + BehaviorManager.instance.Interrupt(Owner, children[prevChildIndex], this, TaskStatus.Failure); + executionStatus = TaskStatus.Inactive; + } + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/UtilitySelector.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/UtilitySelector.cs.meta new file mode 100644 index 000000000..fb82aaeed --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Composites/UtilitySelector.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1c21b01ca0aa9004fa3a76c9d596eeb1 +timeCreated: 1465679373 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Composites/UtilitySelector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals.meta new file mode 100644 index 000000000..6c056f2a5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dd959be462adfbc4a8878260547827cb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/HasReceivedEvent.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/HasReceivedEvent.cs new file mode 100644 index 000000000..ba1ef128f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/HasReceivedEvent.cs @@ -0,0 +1,113 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Returns success as soon as the event specified by eventName has been received.")] + [TaskIcon("{SkinColor}HasReceivedEventIcon.png")] + public class HasReceivedEvent : Conditional + { + [Tooltip("The name of the event to receive")] + public SharedString eventName = ""; + [Tooltip("Optionally store the first sent argument")] + [SharedRequired] + public SharedVariable storedValue1; + [Tooltip("Optionally store the second sent argument")] + [SharedRequired] + public SharedVariable storedValue2; + [Tooltip("Optionally store the third sent argument")] + [SharedRequired] + public SharedVariable storedValue3; + + private bool eventReceived = false; + private bool registered = false; + + public override void OnStart() + { + // Let the behavior tree know that we are interested in receiving the event specified + if (!registered) { + Owner.RegisterEvent(eventName.Value, ReceivedEvent); + Owner.RegisterEvent(eventName.Value, ReceivedEvent); + Owner.RegisterEvent(eventName.Value, ReceivedEvent); + Owner.RegisterEvent(eventName.Value, ReceivedEvent); + registered = true; + } + } + + public override TaskStatus OnUpdate() + { + return eventReceived ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnEnd() + { + if (eventReceived) { + Owner.UnregisterEvent(eventName.Value, ReceivedEvent); + Owner.UnregisterEvent(eventName.Value, ReceivedEvent); + Owner.UnregisterEvent(eventName.Value, ReceivedEvent); + Owner.UnregisterEvent(eventName.Value, ReceivedEvent); + registered = false; + } + eventReceived = false; + } + + private void ReceivedEvent() + { + eventReceived = true; + } + + private void ReceivedEvent(object arg1) + { + ReceivedEvent(); + + if (storedValue1 != null && !storedValue1.IsNone) { + storedValue1.SetValue(arg1); + } + } + + private void ReceivedEvent(object arg1, object arg2) + { + ReceivedEvent(); + + if (storedValue1 != null && !storedValue1.IsNone) { + storedValue1.SetValue(arg1); + } + + if (storedValue2 != null && !storedValue2.IsNone) { + storedValue2.SetValue(arg2); + } + } + + private void ReceivedEvent(object arg1, object arg2, object arg3) + { + ReceivedEvent(); + + if (storedValue1 != null && !storedValue1.IsNone) { + storedValue1.SetValue(arg1); + } + + if (storedValue2 != null && !storedValue2.IsNone) { + storedValue2.SetValue(arg2); + } + + if (storedValue3 != null && !storedValue3.IsNone) { + storedValue3.SetValue(arg3); + } + } + + public override void OnBehaviorComplete() + { + // Stop receiving the event when the behavior tree is complete + Owner.UnregisterEvent(eventName.Value, ReceivedEvent); + Owner.UnregisterEvent(eventName.Value, ReceivedEvent); + Owner.UnregisterEvent(eventName.Value, ReceivedEvent); + Owner.UnregisterEvent(eventName.Value, ReceivedEvent); + + eventReceived = false; + registered = false; + } + + public override void OnReset() + { + // Reset the properties back to their original values + eventName = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/HasReceivedEvent.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/HasReceivedEvent.cs.meta new file mode 100644 index 000000000..509dea527 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/HasReceivedEvent.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7c0c7f545b074cb48bd552b038ede7af +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Conditionals/HasReceivedEvent.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics.meta new file mode 100644 index 000000000..03fc8c3fe --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d5b2388776cf10a438e7a4357267c555 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredCollision.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredCollision.cs new file mode 100644 index 000000000..f3c8ba7ba --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredCollision.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("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).")] + [TaskCategory("Physics")] + 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) || collision.gameObject.CompareTag(tag.Value)) { + collidedGameObject.Value = collision.gameObject; + enteredCollision = true; + } + } + + public override void OnReset() + { + tag = ""; + collidedGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredCollision.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredCollision.cs.meta new file mode 100644 index 000000000..64e046057 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredCollision.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c1841a802d7ceda449423f001897ecae +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredCollision.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredCollision2D.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredCollision2D.cs new file mode 100644 index 000000000..cff2872da --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredCollision2D.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("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).")] + [TaskCategory("Physics")] + 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) || collision.gameObject.CompareTag(tag.Value)) { + collidedGameObject.Value = collision.gameObject; + enteredCollision = true; + } + } + + public override void OnReset() + { + tag = ""; + collidedGameObject = null; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredCollision2D.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredCollision2D.cs.meta new file mode 100644 index 000000000..6aef93b75 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredCollision2D.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 0ac128198630a2d4b9fee93cc9a1f8fd +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredCollision2D.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredTrigger.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredTrigger.cs new file mode 100644 index 000000000..4ec2709a8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredTrigger.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("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).")] + [TaskCategory("Physics")] + 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) || other.gameObject.CompareTag(tag.Value)) { + otherGameObject.Value = other.gameObject; + enteredTrigger = true; + } + } + + public override void OnReset() + { + tag = ""; + otherGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredTrigger.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredTrigger.cs.meta new file mode 100644 index 000000000..ea3bebd64 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredTrigger.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5987844efe0fca7499cec04a9e3962cc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredTrigger.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredTrigger2D.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredTrigger2D.cs new file mode 100644 index 000000000..9cfa1b1f4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredTrigger2D.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("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).")] + [TaskCategory("Physics")] + 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) || other.gameObject.CompareTag(tag.Value)) { + otherGameObject.Value = other.gameObject; + enteredTrigger = true; + } + } + + public override void OnReset() + { + tag = ""; + otherGameObject = null; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredTrigger2D.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredTrigger2D.cs.meta new file mode 100644 index 000000000..614e5c557 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredTrigger2D.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 84e2afb791fe67243a15e45e4af81bb4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasEnteredTrigger2D.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedCollision.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedCollision.cs new file mode 100644 index 000000000..e561a020c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedCollision.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("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).")] + [TaskCategory("Physics")] + 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) || collision.gameObject.CompareTag(tag.Value)) { + collidedGameObject.Value = collision.gameObject; + exitedCollision = true; + } + } + + public override void OnReset() + { + collidedGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedCollision.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedCollision.cs.meta new file mode 100644 index 000000000..0e684855c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedCollision.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 900905a3e42f74c49a6e503349ee651e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedCollision.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedCollision2D.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedCollision2D.cs new file mode 100644 index 000000000..50c6b8bd0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedCollision2D.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("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).")] + [TaskCategory("Physics")] + 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) || collision.gameObject.CompareTag(tag.Value)) { + collidedGameObject.Value = collision.gameObject; + exitedCollision = true; + } + } + + public override void OnReset() + { + tag = ""; + collidedGameObject = null; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedCollision2D.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedCollision2D.cs.meta new file mode 100644 index 000000000..7557cb70a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedCollision2D.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 31cf8edd114ac5c4db22ec65babb3dd3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedCollision2D.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedTrigger.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedTrigger.cs new file mode 100644 index 000000000..bd1d17b6c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedTrigger.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("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).")] + [TaskCategory("Physics")] + 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) || other.gameObject.CompareTag(tag.Value)) { + otherGameObject.Value = other.gameObject; + exitedTrigger = true; + } + } + + public override void OnReset() + { + tag = ""; + otherGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedTrigger.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedTrigger.cs.meta new file mode 100644 index 000000000..cd07cec03 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedTrigger.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c7ccd4a2c35d4c748b65ccd086e777e1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedTrigger.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedTrigger2D.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedTrigger2D.cs new file mode 100644 index 000000000..5cbf54910 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedTrigger2D.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("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).")] + [TaskCategory("Physics")] + 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) || other.gameObject.CompareTag(tag.Value)) { + otherGameObject.Value = other.gameObject; + exitedTrigger = true; + } + } + + public override void OnReset() + { + tag = ""; + otherGameObject = null; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedTrigger2D.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedTrigger2D.cs.meta new file mode 100644 index 000000000..1a4b96427 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedTrigger2D.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ff0486d46da2f7844ac74c6e2ad5af89 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Conditionals/Physics/HasExitedTrigger2D.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/RandomProbability.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/RandomProbability.cs new file mode 100644 index 000000000..128067774 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/RandomProbability.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("The random probability task will return success when the random probability is below the succeed probability. It will otherwise return failure.")] + public class RandomProbability : Conditional + { + [Tooltip("The chance that the task will return success")] + public SharedFloat successProbability = 0.5f; + [Tooltip("Seed the random number generator to make things easier to debug")] + public SharedInt seed; + [Tooltip("Do we want to use the seed?")] + public SharedBool useSeed; + + public override void OnAwake() + { + // If specified, use the seed provided. + if (useSeed.Value) { + Random.InitState(seed.Value); + } + } + + public override TaskStatus OnUpdate() + { + // Return success if random value is less than the success probability. Otherwise return failure. + float randomValue = Random.value; + if (randomValue < successProbability.Value) { + return TaskStatus.Success; + } + return TaskStatus.Failure; + } + + public override void OnReset() + { + // Reset the public properties back to their original values + successProbability = 0.5f; + seed = 0; + useSeed = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/RandomProbability.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/RandomProbability.cs.meta new file mode 100644 index 000000000..01d0857c2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/RandomProbability.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 468a21510e9558c49a47238ebe4c2270 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Conditionals/RandomProbability.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection.meta new file mode 100644 index 000000000..2ea332682 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1fb2ec5c5ded45443834596a451000f9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection/CompareFieldValue.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection/CompareFieldValue.cs new file mode 100644 index 000000000..1f0281175 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection/CompareFieldValue.cs @@ -0,0 +1,60 @@ +using UnityEngine; +using System; +using System.Reflection; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Compares the field value to the value specified. Returns success if the values are the same.")] + [TaskCategory("Reflection")] + [TaskIcon("{SkinColor}ReflectionIcon.png")] + public class CompareFieldValue : Conditional + { + [Tooltip("The GameObject to compare the field on")] + public SharedGameObject targetGameObject; + [Tooltip("The component to compare the field on")] + public SharedString componentName; + [Tooltip("The name of the field")] + public SharedString fieldName; + [Tooltip("The value to compare to")] + public SharedVariable compareValue; + + public override TaskStatus OnUpdate() + { + if (compareValue == null) { + Debug.LogWarning("Unable to compare field - compare value is null"); + return TaskStatus.Failure; + } + + var type = TaskUtility.GetTypeWithinAssembly(componentName.Value); + if (type == null) { + Debug.LogWarning("Unable to compare field - type is null"); + return TaskStatus.Failure; + } + + var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type); + if (component == null) { + Debug.LogWarning("Unable to compare the field with component " + componentName.Value); + return TaskStatus.Failure; + } + + // If you are receiving a compiler error on the Windows Store platform see this topic: + // https://www.opsive.com/support/documentation/behavior-designer/installation/ + var field = component.GetType().GetField(fieldName.Value); + var fieldValue = field.GetValue(component); + + if (fieldValue == null && compareValue.GetValue() == null) { + return TaskStatus.Success; + } + + return fieldValue.Equals(compareValue.GetValue()) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + componentName = null; + fieldName = null; + compareValue = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection/CompareFieldValue.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection/CompareFieldValue.cs.meta new file mode 100644 index 000000000..dabbada65 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection/CompareFieldValue.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: cc6496fb6757b684c8cc0c4ac8929319 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection/CompareFieldValue.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection/ComparePropertyValue.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection/ComparePropertyValue.cs new file mode 100644 index 000000000..a72d0d0ad --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection/ComparePropertyValue.cs @@ -0,0 +1,58 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Compares the property value to the value specified. Returns success if the values are the same.")] + [TaskCategory("Reflection")] + [TaskIcon("{SkinColor}ReflectionIcon.png")] + public class ComparePropertyValue : Conditional + { + [Tooltip("The GameObject to compare the property of")] + public SharedGameObject targetGameObject; + [Tooltip("The component to compare the property of")] + public SharedString componentName; + [Tooltip("The name of the property")] + public SharedString propertyName; + [Tooltip("The value to compare to")] + public SharedVariable compareValue; + + public override TaskStatus OnUpdate() + { + if (compareValue == null) { + Debug.LogWarning("Unable to compare field - compare value is null"); + return TaskStatus.Failure; + } + + var type = TaskUtility.GetTypeWithinAssembly(componentName.Value); + if (type == null) { + Debug.LogWarning("Unable to compare property - type is null"); + return TaskStatus.Failure; + } + + var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type); + if (component == null) { + Debug.LogWarning("Unable to compare the property with component " + componentName.Value); + return TaskStatus.Failure; + } + + // If you are receiving a compiler error on the Windows Store platform see this topic: + // https://www.opsive.com/support/documentation/behavior-designer/installation/ + var property = component.GetType().GetProperty(propertyName.Value); + var propertyValue = property.GetValue(component, null); + + if (propertyValue == null && compareValue.GetValue() == null) { + return TaskStatus.Success; + } + + return propertyValue.Equals(compareValue.GetValue()) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + componentName = null; + propertyName = null; + compareValue = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection/ComparePropertyValue.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection/ComparePropertyValue.cs.meta new file mode 100644 index 000000000..c259f875d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection/ComparePropertyValue.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f8b0fa403f826a74087ece4b81fec1c7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Conditionals/Reflection/ComparePropertyValue.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/StackedConditional.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/StackedConditional.cs new file mode 100644 index 000000000..c4146861f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/StackedConditional.cs @@ -0,0 +1,270 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Allows multiple conditional tasks to be added to a single node.")] + [TaskIcon("{SkinColor}StackedConditionalIcon.png")] + public class StackedConditional : Conditional + { + [InspectTask] + public Conditional[] conditionals; + public enum ComparisonType + { + Sequence, + Selector + } + [Tooltip("Specifies if the tasks should be traversed with an AND (Sequence) or an OR (Selector).")] + public ComparisonType comparisonType; + [Tooltip("Should the tasks be labeled within the graph?")] + public bool graphLabel; + + public override void OnAwake() + { + if (conditionals == null) { + return; + } + + for (int i = 0; i < conditionals.Length; ++i) { + if (conditionals[i] == null) { + continue; + } + + conditionals[i].GameObject = gameObject; + conditionals[i].Transform = transform; + conditionals[i].Owner = Owner; +#if UNITY_EDITOR || DLL_RELEASE || DLL_DEBUG + conditionals[i].NodeData = new NodeData(); +#endif + conditionals[i].OnAwake(); + } + } + + public override void OnStart() + { + if (conditionals == null) { + return; + } + + for (int i = 0; i < conditionals.Length; ++i) { + if (conditionals[i] == null) { + continue; + } + conditionals[i].OnStart(); + } + } + + public override TaskStatus OnUpdate() + { + if (conditionals == null) { + return TaskStatus.Failure; + } + + for (int i = 0; i < conditionals.Length; ++i) { + if (conditionals[i] == null) { + continue; + } + var executionStatus = conditionals[i].OnUpdate(); +#if UNITY_EDITOR || DLL_RELEASE || DLL_DEBUG + conditionals[i].NodeData.ExecutionStatus = executionStatus; + if (conditionals[i].NodeData.ExecutionStatus == TaskStatus.Running) { + Debug.LogWarning("Warning: The conditional task returned a status of running when conditional tasks should only return success or failure."); + } +#endif + if (comparisonType == ComparisonType.Sequence && executionStatus == TaskStatus.Failure) { + return TaskStatus.Failure; + } else if (comparisonType == ComparisonType.Selector && executionStatus == TaskStatus.Success) { + return TaskStatus.Success; + } + } + return comparisonType == ComparisonType.Sequence ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnFixedUpdate() + { + if (conditionals == null) { + return; + } + + for (int i = 0; i < conditionals.Length; ++i) { + if (conditionals[i] == null) { + continue; + } + conditionals[i].OnFixedUpdate(); + } + } + + public override void OnLateUpdate() + { + if (conditionals == null) { + return; + } + + for (int i = 0; i < conditionals.Length; ++i) { + if (conditionals[i] == null) { + continue; + } + conditionals[i].OnLateUpdate(); + } + } + + public override void OnEnd() + { + if (conditionals == null) { + return; + } + + for (int i = 0; i < conditionals.Length; ++i) { + if (conditionals[i] == null) { + continue; + } + conditionals[i].OnEnd(); + } + } + + public override void OnTriggerEnter(Collider other) + { + if (conditionals == null) { + return; + } + + for (int i = 0; i < conditionals.Length; ++i) { + if (conditionals[i] == null) { + continue; + } + conditionals[i].OnTriggerEnter(other); + } + } + + public override void OnTriggerEnter2D(Collider2D other) + { + if (conditionals == null) { + return; + } + + for (int i = 0; i < conditionals.Length; ++i) { + if (conditionals[i] == null) { + continue; + } + conditionals[i].OnTriggerEnter2D(other); + } + } + + public override void OnTriggerExit(Collider other) + { + if (conditionals == null) { + return; + } + + for (int i = 0; i < conditionals.Length; ++i) { + if (conditionals[i] == null) { + continue; + } + conditionals[i].OnTriggerExit(other); + } + } + + public override void OnTriggerExit2D(Collider2D other) + { + if (conditionals == null) { + return; + } + + for (int i = 0; i < conditionals.Length; ++i) { + if (conditionals[i] == null) { + continue; + } + conditionals[i].OnTriggerExit2D(other); + } + } + + public override void OnCollisionEnter(Collision collision) + { + if (conditionals == null) { + return; + } + + for (int i = 0; i < conditionals.Length; ++i) { + if (conditionals[i] == null) { + continue; + } + conditionals[i].OnCollisionEnter(collision); + } + } + + public override void OnCollisionEnter2D(Collision2D collision) + { + if (conditionals == null) { + return; + } + + for (int i = 0; i < conditionals.Length; ++i) { + if (conditionals[i] == null) { + continue; + } + conditionals[i].OnCollisionEnter2D(collision); + } + } + + public override void OnCollisionExit(Collision collision) + { + if (conditionals == null) { + return; + } + + for (int i = 0; i < conditionals.Length; ++i) { + if (conditionals[i] == null) { + continue; + } + conditionals[i].OnCollisionExit(collision); + } + } + + public override void OnCollisionExit2D(Collision2D collision) + { + if (conditionals == null) { + return; + } + + for (int i = 0; i < conditionals.Length; ++i) { + if (conditionals[i] == null) { + continue; + } + conditionals[i].OnCollisionExit2D(collision); + } + } + + public override string OnDrawNodeText() + { + if (conditionals == null || !graphLabel) { + return string.Empty; + } + + var text = string.Empty; + for (int i = 0; i < conditionals.Length; ++i) { + if (conditionals[i] == null) { + continue; + } + if (!string.IsNullOrEmpty(text)) { + text += "\n"; + } + text += conditionals[i].GetType().Name; + } + + return text; + } + + public override void OnReset() + { + if (conditionals == null) { + return; + } + + for (int i = 0; i < conditionals.Length; ++i) { + if (conditionals[i] == null) { + continue; + } + conditionals[i].OnReset(); + } + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/StackedConditional.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/StackedConditional.cs.meta new file mode 100644 index 000000000..04244fa12 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Conditionals/StackedConditional.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 931664f35b02f4f438964c2f7eb4a8ae +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Conditionals/StackedConditional.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators.meta new file mode 100644 index 000000000..9961e5b39 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c3a63466abc2809449aec6088f9153e6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ConditionalEvaluator.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ConditionalEvaluator.cs new file mode 100644 index 000000000..46d78c0fe --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ConditionalEvaluator.cs @@ -0,0 +1,110 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Evaluates the specified conditional task. If the conditional task returns success then the child task is run and the child status is returned. If the conditional task does not " + + "return success then the child task is not run and a failure status is immediately returned.")] + [TaskIcon("{SkinColor}ConditionalEvaluatorIcon.png")] + public class ConditionalEvaluator : Decorator + { + [Tooltip("Should the conditional task be reevaluated every tick?")] + public SharedBool reevaluate; + [InspectTask] + [Tooltip("The conditional task to evaluate")] + public Conditional conditionalTask; + [Tooltip("Should the inspected conditional task be labeled within the graph?")] + public bool graphLabel; + + // The status of the child after it has finished running. + private TaskStatus executionStatus = TaskStatus.Inactive; + private bool checkConditionalTask = true; + private bool conditionalTaskFailed = false; + + public override void OnAwake() + { + if (conditionalTask != null) { + conditionalTask.Owner = Owner; + conditionalTask.GameObject = gameObject; + conditionalTask.Transform = transform; + conditionalTask.OnAwake(); + } + } + + public override void OnStart() + { + if (conditionalTask != null) { + conditionalTask.OnStart(); + } + } + + public override bool CanExecute() + { + // CanExecute is called when checking the condition within a while loop so it will be called at least twice. Ensure the conditional task is checked only once + if (checkConditionalTask) { + checkConditionalTask = false; + OnUpdate(); + } + + if (conditionalTaskFailed) { + return false; + } + return executionStatus == TaskStatus.Inactive || executionStatus == TaskStatus.Running; + } + + public override bool CanReevaluate() + { + return reevaluate.Value; + } + + public override TaskStatus OnUpdate() + { + var childStatus = conditionalTask.OnUpdate(); + conditionalTaskFailed = conditionalTask == null || childStatus == TaskStatus.Failure; + return childStatus; + } + + public override void OnChildExecuted(TaskStatus childStatus) + { + // Update the execution status after a child has finished running. + executionStatus = childStatus; + } + + public override TaskStatus OverrideStatus() + { + // This version of OverrideStatus is called when the conditional evaluator fails reevaluation and has to stop all of its children. + // Therefore, the return status will always be failure + return TaskStatus.Failure; + } + + public override TaskStatus OverrideStatus(TaskStatus status) + { + if (conditionalTaskFailed) + return TaskStatus.Failure; + return status; + } + + public override void OnEnd() + { + // Reset the variables back to their starting values. + executionStatus = TaskStatus.Inactive; + checkConditionalTask = true; + conditionalTaskFailed = false; + if (conditionalTask != null) { + conditionalTask.OnEnd(); + } + } + + public override string OnDrawNodeText() + { + if (conditionalTask == null || !graphLabel) { + return string.Empty; + } + + return conditionalTask.GetType().Name; + } + + public override void OnReset() + { + // Reset the public properties back to their original values. + conditionalTask = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ConditionalEvaluator.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ConditionalEvaluator.cs.meta new file mode 100644 index 000000000..f73f0252f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ConditionalEvaluator.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 632578e05169d1d45a1ab77ae8bb45ad +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Decorators/ConditionalEvaluator.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Cooldown.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Cooldown.cs new file mode 100644 index 000000000..e47611df5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Cooldown.cs @@ -0,0 +1,63 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("Waits the specified duration after the child has completed before returning the child's status of success or failure.")] + [TaskIcon("{SkinColor}CooldownIcon.png")] + public class Cooldown : Decorator + { + public SharedFloat duration = 2; + + // The status of the child after it has finished running. + private TaskStatus executionStatus = TaskStatus.Inactive; + private float cooldownTime = -1; + + public override bool CanExecute() + { + if (cooldownTime == -1) { + return true; + } + + return cooldownTime + duration.Value > Time.time; + } + + public override int CurrentChildIndex() + { + if (cooldownTime == -1) { + return 0; + } + return -1; + } + + public override void OnChildExecuted(TaskStatus childStatus) + { + executionStatus = childStatus; + if (executionStatus == TaskStatus.Failure || executionStatus == TaskStatus.Success) { + cooldownTime = Time.time; + } + } + + public override TaskStatus OverrideStatus() + { + if (!CanExecute()) { + return TaskStatus.Running; + } + return executionStatus; + } + + public override TaskStatus OverrideStatus(TaskStatus status) + { + if (status == TaskStatus.Running) { + return status; + } + return executionStatus; + } + + public override void OnEnd() + { + // Reset the execution status back to its starting values. + executionStatus = TaskStatus.Inactive; + cooldownTime = -1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Cooldown.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Cooldown.cs.meta new file mode 100644 index 000000000..f81f2572c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Cooldown.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 23da28bae244a1b408d0104cd78706d5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Decorators/Cooldown.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Interrupt.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Interrupt.cs new file mode 100644 index 000000000..be356f336 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Interrupt.cs @@ -0,0 +1,48 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("The interrupt task will stop all child tasks from running if it is interrupted. The interruption can be triggered by the perform interruption task. " + + "The interrupt task will keep running its child until this interruption is called. If no interruption happens and the child task completed its " + + "execution the interrupt task will return the value assigned by the child task.")] + [TaskIcon("{SkinColor}InterruptIcon.png")] + public class Interrupt : Decorator + { + // When an interruption occurs return with this status. + private TaskStatus interruptStatus = TaskStatus.Failure; + // The status of the child after it has finished running. + private TaskStatus executionStatus = TaskStatus.Inactive; + + public override bool CanExecute() + { + // Continue executing until the child task returns success or failure. + return executionStatus == TaskStatus.Inactive || executionStatus == TaskStatus.Running; + } + + public override void OnChildExecuted(TaskStatus childStatus) + { + // Update the execution status after a child has finished running. + executionStatus = childStatus; + } + + public void DoInterrupt(TaskStatus status) + { + // An interruption has occurred. Update the interrupt status and notify the Behavior Manager. The Behavior Manager will stop all + // child tasks from running. + interruptStatus = status; + + BehaviorManager.instance.Interrupt(Owner, this, status); + } + + public override TaskStatus OverrideStatus() + { + // Return the interruption status as our status. + return interruptStatus; + } + + public override void OnEnd() + { + // Reset the variables back to their starting values. + interruptStatus = TaskStatus.Failure; + executionStatus = TaskStatus.Inactive; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Interrupt.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Interrupt.cs.meta new file mode 100644 index 000000000..bc673347b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Interrupt.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 81c44aaaa87500145831c0e167a5bfd3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Decorators/Interrupt.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Inverter.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Inverter.cs new file mode 100644 index 000000000..707138f6d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Inverter.cs @@ -0,0 +1,40 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("The inverter task will invert the return value of the child task after it has finished executing. " + + "If the child returns success, the inverter task will return failure. If the child returns failure, the inverter task will return success.")] + [TaskIcon("{SkinColor}InverterIcon.png")] + public class Inverter : Decorator + { + // The status of the child after it has finished running. + private TaskStatus executionStatus = TaskStatus.Inactive; + + public override bool CanExecute() + { + // Continue executing until the child task returns success or failure. + return executionStatus == TaskStatus.Inactive || executionStatus == TaskStatus.Running; + } + + public override void OnChildExecuted(TaskStatus childStatus) + { + // Update the execution status after a child has finished running. + executionStatus = childStatus; + } + + public override TaskStatus Decorate(TaskStatus status) + { + // Invert the task status. + if (status == TaskStatus.Success) { + return TaskStatus.Failure; + } else if (status == TaskStatus.Failure) { + return TaskStatus.Success; + } + return status; + } + + public override void OnEnd() + { + // Reset the execution status back to its starting values. + executionStatus = TaskStatus.Inactive; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Inverter.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Inverter.cs.meta new file mode 100644 index 000000000..7d7a6e571 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Inverter.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 577fcf144ebc85642889f2dd11147272 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Decorators/Inverter.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Repeater.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Repeater.cs new file mode 100644 index 000000000..a4daa3955 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Repeater.cs @@ -0,0 +1,47 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription(@"The repeater task will repeat execution of its child task until the child task has been run a specified number of times. " + + "It has the option of continuing to execute the child task even if the child task returns a failure.")] + [TaskIcon("{SkinColor}RepeaterIcon.png")] + public class Repeater : Decorator + { + [Tooltip("The number of times to repeat the execution of its child task")] + public SharedInt count = 1; + [Tooltip("Allows the repeater to repeat forever")] + public SharedBool repeatForever; + [Tooltip("Should the task return if the child task returns a failure")] + public SharedBool endOnFailure; + + // The number of times the child task has been run. + private int executionCount = 0; + // The status of the child after it has finished running. + private TaskStatus executionStatus = TaskStatus.Inactive; + + public override bool CanExecute() + { + // Continue executing until we've reached the count or the child task returned failure and we should stop on a failure. + return (repeatForever.Value || executionCount < count.Value) && (!endOnFailure.Value || (endOnFailure.Value && executionStatus != TaskStatus.Failure)); + } + + public override void OnChildExecuted(TaskStatus childStatus) + { + // The child task has finished execution. Increase the execution count and update the execution status. + executionCount++; + executionStatus = childStatus; + } + + public override void OnEnd() + { + // Reset the variables back to their starting values. + executionCount = 0; + executionStatus = TaskStatus.Inactive; + } + + public override void OnReset() + { + // Reset the public properties back to their original values. + count = 0; + endOnFailure = true; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Repeater.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Repeater.cs.meta new file mode 100644 index 000000000..d4c9dbc95 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/Repeater.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: e62515fa6915f0d4f88b808e2e77d3ff +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Decorators/Repeater.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ReturnFailure.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ReturnFailure.cs new file mode 100644 index 000000000..98cd7b145 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ReturnFailure.cs @@ -0,0 +1,37 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("The return failure task will always return failure except when the child task is running.")] + [TaskIcon("{SkinColor}ReturnFailureIcon.png")] + public class ReturnFailure : Decorator + { + // The status of the child after it has finished running. + private TaskStatus executionStatus = TaskStatus.Inactive; + + public override bool CanExecute() + { + // Continue executing until the child task returns success or failure. + return executionStatus == TaskStatus.Inactive || executionStatus == TaskStatus.Running; + } + + public override void OnChildExecuted(TaskStatus childStatus) + { + // Update the execution status after a child has finished running. + executionStatus = childStatus; + } + + public override TaskStatus Decorate(TaskStatus status) + { + // Return failure even if the child task returned success. + if (status == TaskStatus.Success) { + return TaskStatus.Failure; + } + return status; + } + + public override void OnEnd() + { + // Reset the execution status back to its starting values. + executionStatus = TaskStatus.Inactive; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ReturnFailure.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ReturnFailure.cs.meta new file mode 100644 index 000000000..af852a48b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ReturnFailure.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: f34d21f1bb4e761478bdf76222fcf135 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Decorators/ReturnFailure.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ReturnSuccess.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ReturnSuccess.cs new file mode 100644 index 000000000..67eb0ead0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ReturnSuccess.cs @@ -0,0 +1,37 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("The return success task will always return success except when the child task is running.")] + [TaskIcon("{SkinColor}ReturnSuccessIcon.png")] + public class ReturnSuccess : Decorator + { + // The status of the child after it has finished running. + private TaskStatus executionStatus = TaskStatus.Inactive; + + public override bool CanExecute() + { + // Continue executing until the child task returns success or failure. + return executionStatus == TaskStatus.Inactive || executionStatus == TaskStatus.Running; + } + + public override void OnChildExecuted(TaskStatus childStatus) + { + // Update the execution status after a child has finished running. + executionStatus = childStatus; + } + + public override TaskStatus Decorate(TaskStatus status) + { + // Return success even if the child task returned failure. + if (status == TaskStatus.Failure) { + return TaskStatus.Success; + } + return status; + } + + public override void OnEnd() + { + // Reset the execution status back to its starting values. + executionStatus = TaskStatus.Inactive; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ReturnSuccess.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ReturnSuccess.cs.meta new file mode 100644 index 000000000..f5d10cfea --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/ReturnSuccess.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 27d103b9f961fd44da3c4d83dadd90ca +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Decorators/ReturnSuccess.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/TaskGuard.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/TaskGuard.cs new file mode 100644 index 000000000..e23487308 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/TaskGuard.cs @@ -0,0 +1,76 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("The task guard task is similar to a semaphore in multithreaded programming. The task guard task is there to ensure a limited resource is not being overused. " + + "\n\nFor example, you may place a task guard above a task that plays an animation. Elsewhere within your behavior tree you may also have another task that plays a different " + + "animation but uses the same bones for that animation. Because of this you don't want that animation to play twice at the same time. Placing a task guard will let you " + + "specify how many times a particular task can be accessed at the same time.\n\nIn the previous animation task example you would specify an access count of 1. With this setup " + + "the animation task can be only controlled by one task at a time. If the first task is playing the animation and a second task wants to control the animation as well, it will " + + "either have to wait or skip over the task completely.")] + [TaskIcon("{SkinColor}TaskGuardIcon.png")] + public class TaskGuard : Decorator + { + [Tooltip("The number of times the child tasks can be accessed by parallel tasks at once")] + public SharedInt maxTaskAccessCount; + [Tooltip("The linked tasks that also guard a task. If the task guard is not linked against any other tasks it doesn't have much purpose. Marked as LinkedTask to " + + "ensure all tasks linked are linked to the same set of tasks")] + [LinkedTask] + public TaskGuard[] linkedTaskGuards = null; + [Tooltip("If true the task will wait until the child task is available. If false then any unavailable child tasks will be skipped over")] + public SharedBool waitUntilTaskAvailable; + + // The number of tasks that are currently using a particular task. + private int executingTasks = 0; + // True if the current task is executing. + private bool executing = false; + + public override bool CanExecute() + { + // The child task can execute if the number of executing tasks is less than the maximum number of tasks allowed. + return executingTasks < maxTaskAccessCount.Value && !executing; + } + + public override void OnChildStarted() + { + // The child task has started to run. Increase the executing tasks counter and notify all of the other linked tasks. + executingTasks++; + executing = true; + for (int i = 0; i < linkedTaskGuards.Length; ++i) { + linkedTaskGuards[i].taskExecuting(true); + } + } + + public override TaskStatus OverrideStatus(TaskStatus status) + { + // return a running status if the children are currently waiting for a task to become available + return (!executing && waitUntilTaskAvailable.Value) ? TaskStatus.Running : status; + } + + public void taskExecuting(bool increase) + { + // A linked task is currently executing a task that is being guarded. If the task just started executing then increase will be true and if it is ending then + // true will be false. + executingTasks += (increase ? 1 : -1); + } + + public override void OnEnd() + { + // The child task has been executed or skipped over. Only decrement the executing tasks count if the child task was being executed. Following that + // notify all of the linked tasks that we are done executing. + if (executing) { + executingTasks--; + for (int i = 0; i < linkedTaskGuards.Length; ++i) { + linkedTaskGuards[i].taskExecuting(false); + } + executing = false; + } + } + + public override void OnReset() + { + // Reset the public properties back to their original values + maxTaskAccessCount = null; + linkedTaskGuards = null; + waitUntilTaskAvailable = true; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/TaskGuard.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/TaskGuard.cs.meta new file mode 100644 index 000000000..65ffb3582 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/TaskGuard.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 7e2ae4ab352f20c41be106f92efc3b43 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Decorators/TaskGuard.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/UntilFailure.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/UntilFailure.cs new file mode 100644 index 000000000..ff2cb15b1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/UntilFailure.cs @@ -0,0 +1,28 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("The until failure task will keep executing its child task until the child task returns failure.")] + [TaskIcon("{SkinColor}UntilFailureIcon.png")] + public class UntilFailure : Decorator + { + // The status of the child after it has finished running. + private TaskStatus executionStatus = TaskStatus.Inactive; + + public override bool CanExecute() + { + // Keep running until the child task returns failure. + return executionStatus == TaskStatus.Success || executionStatus == TaskStatus.Inactive; + } + + public override void OnChildExecuted(TaskStatus childStatus) + { + // Update the execution status after a child has finished running. + executionStatus = childStatus; + } + + public override void OnEnd() + { + // Reset the execution status back to its starting values. + executionStatus = TaskStatus.Inactive; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/UntilFailure.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/UntilFailure.cs.meta new file mode 100644 index 000000000..21d77f243 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/UntilFailure.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 934b87f8f563272469cd9a9b14046ae7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Decorators/UntilFailure.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/UntilSuccess.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/UntilSuccess.cs new file mode 100644 index 000000000..25b8ec8c1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/UntilSuccess.cs @@ -0,0 +1,28 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + [TaskDescription("The until success task will keep executing its child task until the child task returns success.")] + [TaskIcon("{SkinColor}UntilSuccessIcon.png")] + public class UntilSuccess : Decorator + { + // The status of the child after it has finished running. + private TaskStatus executionStatus = TaskStatus.Inactive; + + public override bool CanExecute() + { + // Keep running until the child task returns success. + return executionStatus == TaskStatus.Failure || executionStatus == TaskStatus.Inactive; + } + + public override void OnChildExecuted(TaskStatus childStatus) + { + // Update the execution status after a child has finished running. + executionStatus = childStatus; + } + + public override void OnEnd() + { + // Reset the execution status back to its starting values. + executionStatus = TaskStatus.Inactive; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/UntilSuccess.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/UntilSuccess.cs.meta new file mode 100644 index 000000000..4f0be28bb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Decorators/UntilSuccess.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 6d5c2cbf6c58f6b419831477bde98317 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Decorators/UntilSuccess.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/EntryTask.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/EntryTask.cs new file mode 100644 index 000000000..b06ad5957 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/EntryTask.cs @@ -0,0 +1,13 @@ +namespace BehaviorDesigner.Runtime.Tasks +{ + // The entry task is a task that is used for display purposes within Behavior Designer to indicate the root of the tree. It is not a real task and + // cannot be used within the behavior tree. + [TaskIcon("{SkinColor}EntryIcon.png")] + public class EntryTask : ParentTask + { + public override int MaxChildren() + { + return 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/EntryTask.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/EntryTask.cs.meta new file mode 100644 index 000000000..c9881b3f9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/EntryTask.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 143ae0c3fc255864893a532a2571f3d9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/EntryTask.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity.meta new file mode 100644 index 000000000..60a3c06ac --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: de0476b4548c1d4408860e4ee2dd9471 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation.meta new file mode 100644 index 000000000..6479b9043 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: fa1395121fbad8b40934c69350e58065 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Blend.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Blend.cs new file mode 100644 index 000000000..a8409f87b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Blend.cs @@ -0,0 +1,51 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimation +{ + [TaskCategory("Unity/Animation")] + [TaskDescription("Blends the animation. Returns Success.")] + public class Blend : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the animation")] + public SharedString animationName; + [Tooltip("The weight the animation should blend to")] + public float targetWeight = 1; + [Tooltip("The amount of time it takes to blend")] + public float fadeLength = 0.3f; + + // cache the animation component + private Animation animation; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animation = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animation == null) { + Debug.LogWarning("Animation is null"); + return TaskStatus.Failure; + } + + animation.Blend(animationName.Value, targetWeight, fadeLength); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + animationName = ""; + targetWeight = 1; + fadeLength = 0.3f; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Blend.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Blend.cs.meta new file mode 100644 index 000000000..f48b53f02 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Blend.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: dc0640154eb6b674e89f4a2ec1632696 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Blend.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/CrossFade.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/CrossFade.cs new file mode 100644 index 000000000..fb13abd7a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/CrossFade.cs @@ -0,0 +1,58 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimation +{ + [TaskCategory("Unity/Animation")] + [TaskDescription("Fades the animation over a period of time and fades other animations out. Returns Success.")] + public class CrossFade : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the animation")] + public SharedString animationName; + [Tooltip("The speed of the animation. Use a negative value to play the animation backwards")] + public SharedFloat animationSpeed = 1f; + [Tooltip("The amount of time it takes to blend")] + public SharedFloat fadeLength = 0.3f; + [Tooltip("The play mode of the animation")] + public PlayMode playMode = PlayMode.StopSameLayer; + + // cache the animation component + private Animation animation; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animation = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animation == null) { + Debug.LogWarning("Animation is null"); + return TaskStatus.Failure; + } + + animation[animationName.Value].speed = animationSpeed.Value; + if (animation[animationName.Value].speed < 0) { + animation[animationName.Value].time = animation[animationName.Value].length; + } + animation.CrossFade(animationName.Value, fadeLength.Value, playMode); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + animationName.Value = ""; + animationSpeed = 1; + fadeLength = 0.3f; + playMode = PlayMode.StopSameLayer; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/CrossFade.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/CrossFade.cs.meta new file mode 100644 index 000000000..c9ee6ef85 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/CrossFade.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 57d9d1509d13e454caae6f3219c83cc7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/CrossFade.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/CrossFadeQueued.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/CrossFadeQueued.cs new file mode 100644 index 000000000..a52eb3e34 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/CrossFadeQueued.cs @@ -0,0 +1,54 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimation +{ + [TaskCategory("Unity/Animation")] + [TaskDescription("Cross fades an animation after previous animations has finished playing. Returns Success.")] + public class CrossFadeQueued : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the animation")] + public SharedString animationName; + [Tooltip("The amount of time it takes to blend")] + public float fadeLength = 0.3f; + [Tooltip("Specifies when the animation should start playing")] + public QueueMode queue = QueueMode.CompleteOthers; + [Tooltip("The play mode of the animation")] + public PlayMode playMode = PlayMode.StopSameLayer; + + // cache the animation component + private Animation animation; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animation = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animation == null) { + Debug.LogWarning("Animation is null"); + return TaskStatus.Failure; + } + + animation.CrossFadeQueued(animationName.Value, fadeLength, queue, playMode); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + animationName.Value = ""; + fadeLength = 0.3f; + queue = QueueMode.CompleteOthers; + playMode = PlayMode.StopSameLayer; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/CrossFadeQueued.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/CrossFadeQueued.cs.meta new file mode 100644 index 000000000..867faaff2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/CrossFadeQueued.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c1cc2a160ee1978488696564200b3c25 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/CrossFadeQueued.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/GetAnimatePhysics.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/GetAnimatePhysics.cs new file mode 100644 index 000000000..44b5d28b8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/GetAnimatePhysics.cs @@ -0,0 +1,46 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimation +{ + [TaskCategory("Unity/Animation")] + [TaskDescription("Stores the animate physics value. Returns Success.")] + public class GetAnimatePhysics : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Are the if animations are executed in the physics loop?")] + [RequiredField] + public SharedBool storeValue; + + // cache the animation component + private Animation animation; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animation = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animation == null) { + Debug.LogWarning("Animation is null"); + return TaskStatus.Failure; + } + + storeValue.Value = animation.animatePhysics; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue.Value = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/GetAnimatePhysics.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/GetAnimatePhysics.cs.meta new file mode 100644 index 000000000..bd07ff5fd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/GetAnimatePhysics.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b5bd2b0ed07f42142934568bd6813619 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/GetAnimatePhysics.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/IsPlaying.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/IsPlaying.cs new file mode 100644 index 000000000..d96ae6d2d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/IsPlaying.cs @@ -0,0 +1,47 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimation +{ + [TaskCategory("Unity/Animation")] + [TaskDescription("Returns Success if the animation is currently playing.")] + public class IsPlaying : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the animation")] + public SharedString animationName; + + // cache the animation component + private Animation animation; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animation = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animation == null) { + Debug.LogWarning("Animation is null"); + return TaskStatus.Failure; + } + + if (string.IsNullOrEmpty(animationName.Value)) { + return animation.isPlaying ? TaskStatus.Success : TaskStatus.Failure; + } else { + return animation.IsPlaying(animationName.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + } + + public override void OnReset() + { + targetGameObject = null; + animationName.Value = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/IsPlaying.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/IsPlaying.cs.meta new file mode 100644 index 000000000..eb201b47f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/IsPlaying.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ce80475167d230d4181baa69071465ff +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/IsPlaying.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Play.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Play.cs new file mode 100644 index 000000000..623bc08dc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Play.cs @@ -0,0 +1,52 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimation +{ + [TaskCategory("Unity/Animation")] + [TaskDescription("Plays animation without any blending. Returns Success.")] + public class Play : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the animation")] + public SharedString animationName; + [Tooltip("The play mode of the animation")] + public PlayMode playMode = PlayMode.StopSameLayer; + + // cache the animation component + private Animation animation; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animation = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animation == null) { + Debug.LogWarning("Animation is null"); + return TaskStatus.Failure; + } + + if (string.IsNullOrEmpty(animationName.Value)) { + animation.Play(); + } else { + animation.Play(animationName.Value, playMode); + } + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + animationName.Value = ""; + playMode = PlayMode.StopSameLayer; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Play.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Play.cs.meta new file mode 100644 index 000000000..b51306159 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Play.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 0b1bf3b05e79dcc468cf71b63d54a4cd +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Play.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/PlayQueued.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/PlayQueued.cs new file mode 100644 index 000000000..c0fcbaff5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/PlayQueued.cs @@ -0,0 +1,51 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimation +{ + [TaskCategory("Unity/Animation")] + [TaskDescription("Plays an animation after previous animations has finished playing. Returns Success.")] + public class PlayQueued : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the animation")] + public SharedString animationName; + [Tooltip("Specifies when the animation should start playing")] + public QueueMode queue = QueueMode.CompleteOthers; + [Tooltip("The play mode of the animation")] + public PlayMode playMode = PlayMode.StopSameLayer; + + // cache the animation component + private Animation animation; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animation = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animation == null) { + Debug.LogWarning("Animation is null"); + return TaskStatus.Failure; + } + + animation.PlayQueued(animationName.Value, queue, playMode); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + animationName.Value = ""; + queue = QueueMode.CompleteOthers; + playMode = PlayMode.StopSameLayer; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/PlayQueued.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/PlayQueued.cs.meta new file mode 100644 index 000000000..38d52b4d4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/PlayQueued.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: bb55ee97bf8cb3d479de025d77a9c4b6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/PlayQueued.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Rewind.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Rewind.cs new file mode 100644 index 000000000..f3636c99f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Rewind.cs @@ -0,0 +1,49 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimation +{ + [TaskCategory("Unity/Animation")] + [TaskDescription("Rewinds an animation. Rewinds all animations if animationName is blank. Returns Success.")] + public class Rewind : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the animation")] + public SharedString animationName; + + // cache the animation component + private Animation animation; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animation = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animation == null) { + Debug.LogWarning("Animation is null"); + return TaskStatus.Failure; + } + + if (string.IsNullOrEmpty(animationName.Value)) { + animation.Rewind(); + } else { + animation.Rewind(animationName.Value); + } + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + animationName.Value = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Rewind.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Rewind.cs.meta new file mode 100644 index 000000000..c8eea141e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Rewind.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 364beb9f6996556449b9f3e03db75290 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Rewind.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Sample.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Sample.cs new file mode 100644 index 000000000..5cb131918 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Sample.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimation +{ + [TaskCategory("Unity/Animation")] + [TaskDescription("Samples animations at the current state. Returns Success.")] + public class Sample : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + // cache the animation component + private Animation animation; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animation = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animation == null) { + Debug.LogWarning("Animation is null"); + return TaskStatus.Failure; + } + + animation.Sample(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Sample.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Sample.cs.meta new file mode 100644 index 000000000..1b19fcfc4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Sample.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2cc64c997b5d6e640af8cc9bd7cf1b5d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Sample.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/SetAnimatePhysics.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/SetAnimatePhysics.cs new file mode 100644 index 000000000..c6df4be52 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/SetAnimatePhysics.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimation +{ + [TaskCategory("Unity/Animation")] + [TaskDescription("Sets animate physics to the specified value. Returns Success.")] + public class SetAnimatePhysics : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Are animations executed in the physics loop?")] + public SharedBool animatePhysics; + + // cache the animation component + private Animation animation; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animation = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animation == null) { + Debug.LogWarning("Animation is null"); + return TaskStatus.Failure; + } + + animation.animatePhysics = animatePhysics.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + animatePhysics.Value = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/SetAnimatePhysics.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/SetAnimatePhysics.cs.meta new file mode 100644 index 000000000..c3b5cf256 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/SetAnimatePhysics.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f93fd0c7638add0468744d4f7249c1a7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/SetAnimatePhysics.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/SetWrapMode.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/SetWrapMode.cs new file mode 100644 index 000000000..2c2dd5095 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/SetWrapMode.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimation +{ + [TaskCategory("Unity/Animation")] + [TaskDescription("Sets the wrap mode to the specified value. Returns Success.")] + public class SetWrapMode : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("How should time beyond the playback range of the clip be treated?")] + public WrapMode wrapMode = WrapMode.Default; + + // cache the animation component + private Animation animation; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animation = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animation == null) { + Debug.LogWarning("Animation is null"); + return TaskStatus.Failure; + } + + animation.wrapMode = wrapMode; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + wrapMode = WrapMode.Default; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/SetWrapMode.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/SetWrapMode.cs.meta new file mode 100644 index 000000000..cce0784ab --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/SetWrapMode.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 39af69a1e220fc2419a5d34933029ff9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/SetWrapMode.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Stop.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Stop.cs new file mode 100644 index 000000000..c31f35c72 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Stop.cs @@ -0,0 +1,49 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimation +{ + [TaskCategory("Unity/Animation")] + [TaskDescription("Stops an animation. Stops all animations if animationName is blank. Returns Success.")] + public class Stop : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the animation")] + public SharedString animationName; + + // cache the animation component + private Animation animation; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animation = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animation == null) { + Debug.LogWarning("Animation is null"); + return TaskStatus.Failure; + } + + if (string.IsNullOrEmpty(animationName.Value)) { + animation.Stop(); + } else { + animation.Stop(animationName.Value); + } + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + animationName = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Stop.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Stop.cs.meta new file mode 100644 index 000000000..369297f0d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Stop.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c3dca423f03e936449fdb622cac3f430 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animation/Stop.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator.meta new file mode 100644 index 000000000..34457bbad --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 0b46617b2906c0049b19ab613fae2882 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/CrossFade.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/CrossFade.cs new file mode 100644 index 000000000..7c2ace817 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/CrossFade.cs @@ -0,0 +1,53 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Creates a dynamic transition between the current state and the destination state. Returns Success.")] + public class CrossFade : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the state")] + public SharedString stateName; + [Tooltip("The duration of the transition. Value is in source state normalized time")] + public SharedFloat transitionDuration; + [Tooltip("The layer where the state is")] + public int layer = -1; + [Tooltip("The normalized time at which the state will play")] + public float normalizedTime = float.NegativeInfinity; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + animator.CrossFade(stateName.Value, transitionDuration.Value, layer, normalizedTime); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + stateName = ""; + transitionDuration = 0; + layer = -1; + normalizedTime = float.NegativeInfinity; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/CrossFade.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/CrossFade.cs.meta new file mode 100644 index 000000000..7916ad7d8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/CrossFade.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 09e5aba2adc719f42876293bcbea7819 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/CrossFade.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetApplyRootMotion.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetApplyRootMotion.cs new file mode 100644 index 000000000..1069fd335 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetApplyRootMotion.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Stores if root motion is applied. Returns Success.")] + public class GetApplyRootMotion : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Is root motion applied?")] + [RequiredField] + public SharedBool storeValue; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + storeValue.Value = animator.applyRootMotion; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetApplyRootMotion.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetApplyRootMotion.cs.meta new file mode 100644 index 000000000..f2d55841b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetApplyRootMotion.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 872c96b3950799546863110b7e54d0c8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetApplyRootMotion.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetBoolParameter.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetBoolParameter.cs new file mode 100644 index 000000000..028c00b88 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetBoolParameter.cs @@ -0,0 +1,48 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Stores the bool parameter on an animator. Returns Success.")] + public class GetBoolParameter : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the parameter")] + public SharedString paramaterName; + [Tooltip("The value of the bool parameter")] + [RequiredField] + public SharedBool storeValue; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + storeValue.Value = animator.GetBool(paramaterName.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + paramaterName = ""; + storeValue = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetBoolParameter.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetBoolParameter.cs.meta new file mode 100644 index 000000000..b2197a424 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetBoolParameter.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2aeb7ebc08541794aa3ed0343c49c9f9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetBoolParameter.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetDeltaPosition.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetDeltaPosition.cs new file mode 100644 index 000000000..91d59ba53 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetDeltaPosition.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Gets the avatar delta position for the last evaluated frame. Returns Success.")] + public class GetDeltaPosition : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The avatar delta position")] + [RequiredField] + public SharedVector3 storeValue; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + storeValue.Value = animator.deltaPosition; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetDeltaPosition.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetDeltaPosition.cs.meta new file mode 100644 index 000000000..f62248022 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetDeltaPosition.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9c44c26d5d6b3484397b8aa6ed658b1e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetDeltaPosition.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetDeltaRotation.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetDeltaRotation.cs new file mode 100644 index 000000000..bb7a1cf37 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetDeltaRotation.cs @@ -0,0 +1,46 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Gets the avatar delta rotation for the last evaluated frame. Returns Success.")] + public class GetDeltaRotation : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The avatar delta rotation")] + [RequiredField] + public SharedQuaternion storeValue; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + storeValue.Value = animator.deltaRotation; + + return TaskStatus.Success; + } + + public override void OnReset() + { + if (storeValue != null) { + storeValue.Value = Quaternion.identity; + } + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetDeltaRotation.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetDeltaRotation.cs.meta new file mode 100644 index 000000000..e7ccde7c0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetDeltaRotation.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f120073dca714344495aa139eea16e2b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetDeltaRotation.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetFloatParameter.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetFloatParameter.cs new file mode 100644 index 000000000..5253f574a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetFloatParameter.cs @@ -0,0 +1,48 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Stores the float parameter on an animator. Returns Success.")] + public class GetFloatParameter : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the parameter")] + public SharedString paramaterName; + [Tooltip("The value of the float parameter")] + [RequiredField] + public SharedFloat storeValue; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + storeValue.Value = animator.GetFloat(paramaterName.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + paramaterName = ""; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetFloatParameter.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetFloatParameter.cs.meta new file mode 100644 index 000000000..2cbe2a306 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetFloatParameter.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d33dbb5444b5bbe44bb200e39823cfe1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetFloatParameter.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetGravityWeight.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetGravityWeight.cs new file mode 100644 index 000000000..ee67a2942 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetGravityWeight.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Stores the current gravity weight based on current animations that are played. Returns Success.")] + public class GetGravityWeight : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The value of the gravity weight")] + [RequiredField] + public SharedFloat storeValue; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + storeValue.Value = animator.gravityWeight; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetGravityWeight.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetGravityWeight.cs.meta new file mode 100644 index 000000000..747fbff0c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetGravityWeight.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 945593329da80b44898e7e1ae1883d07 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetGravityWeight.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetIntegerParameter.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetIntegerParameter.cs new file mode 100644 index 000000000..20ad2799a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetIntegerParameter.cs @@ -0,0 +1,48 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Stores the integer parameter on an animator. Returns Success.")] + public class GetIntegerParameter : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the parameter")] + public SharedString paramaterName; + [Tooltip("The value of the integer parameter")] + [RequiredField] + public SharedInt storeValue; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + storeValue.Value = animator.GetInteger(paramaterName.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + paramaterName = ""; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetIntegerParameter.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetIntegerParameter.cs.meta new file mode 100644 index 000000000..fe92ed57b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetIntegerParameter.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c8640eaeae64c2e48ba85336474d59d8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetIntegerParameter.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetLayerWeight.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetLayerWeight.cs new file mode 100644 index 000000000..8987217d2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetLayerWeight.cs @@ -0,0 +1,48 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Stores the layer's weight. Returns Success.")] + public class GetLayerWeight : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The index of the layer")] + public SharedInt index; + [Tooltip("The value of the float parameter")] + [RequiredField] + public SharedFloat storeValue; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + storeValue.Value = animator.GetLayerWeight(index.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + index = 0; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetLayerWeight.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetLayerWeight.cs.meta new file mode 100644 index 000000000..dee479a41 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetLayerWeight.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 346c4295a827d9e4c8029cd29a8e18ca +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetLayerWeight.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetSpeed.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetSpeed.cs new file mode 100644 index 000000000..f8690623c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetSpeed.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Stores the playback speed of the animator. 1 is normal playback speed. Returns Success.")] + public class GetSpeed : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The playback speed of the Animator")] + [RequiredField] + public SharedFloat storeValue; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + storeValue.Value = animator.speed; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetSpeed.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetSpeed.cs.meta new file mode 100644 index 000000000..2de4c6746 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetSpeed.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f87648f776ab12c45883b01e9bebc6a3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetSpeed.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetStringToHash.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetStringToHash.cs new file mode 100644 index 000000000..c905a7cd9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetStringToHash.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Converts the state name to its corresponding hash code. Returns Success.")] + public class GetStringToHash : Action + { + [Tooltip("The name of the state to convert to a hash code")] + public SharedString stateName; + [Tooltip("The hash value")] + [RequiredField] + public SharedInt storeValue; + + public override TaskStatus OnUpdate() + { + storeValue.Value = Animator.StringToHash(stateName.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + stateName = ""; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetStringToHash.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetStringToHash.cs.meta new file mode 100644 index 000000000..3065630ef --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetStringToHash.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 234dcf26bcb550043b3b5de33f0e6a11 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/GetStringToHash.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/InterruptMatchTarget.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/InterruptMatchTarget.cs new file mode 100644 index 000000000..a08688caa --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/InterruptMatchTarget.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Interrupts the automatic target matching. Returns Success.")] + public class InterruptMatchTarget : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("CompleteMatch will make the gameobject match the target completely at the next frame")] + public bool completeMatch = true; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + animator.InterruptMatchTarget(completeMatch); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + completeMatch = true; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/InterruptMatchTarget.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/InterruptMatchTarget.cs.meta new file mode 100644 index 000000000..0cba0741c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/InterruptMatchTarget.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 766d802f8842a2945b11253f60d431bb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/InterruptMatchTarget.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsInTransition.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsInTransition.cs new file mode 100644 index 000000000..cd05c4841 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsInTransition.cs @@ -0,0 +1,42 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Returns success if the specified AnimatorController layer in a transition.")] + public class IsInTransition : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The layer's index")] + public SharedInt index; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + return animator.IsInTransition(index.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + index = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsInTransition.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsInTransition.cs.meta new file mode 100644 index 000000000..db16f358a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsInTransition.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 48c086aaf693a604d8b83eabac3b568e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsInTransition.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsName.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsName.cs new file mode 100644 index 000000000..d5cbdbe4a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsName.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Returns success if the specified name matches the name of the active state.")] + public class IsName : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The layer's index")] + public SharedInt index; + [Tooltip("The state name to compare")] + public SharedString name; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + return animator.GetCurrentAnimatorStateInfo(index.Value).IsName(name.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + index = 0; + name = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsName.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsName.cs.meta new file mode 100644 index 000000000..cc0188196 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsName.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 96051e2f6a0e7ea42a493e6245e4ccde +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsName.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsParameterControlledByCurve.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsParameterControlledByCurve.cs new file mode 100644 index 000000000..225c27426 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsParameterControlledByCurve.cs @@ -0,0 +1,42 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Returns success if the specified parameter is controlled by an additional curve on an animation.")] + public class IsParameterControlledByCurve : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the parameter")] + public SharedString paramaterName; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + return animator.IsParameterControlledByCurve(paramaterName.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + paramaterName = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsParameterControlledByCurve.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsParameterControlledByCurve.cs.meta new file mode 100644 index 000000000..845940318 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsParameterControlledByCurve.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c5eb4141402ab7c4abb1d4a5c687a757 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/IsParameterControlledByCurve.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/MatchTarget.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/MatchTarget.cs new file mode 100644 index 000000000..ada0bf5db --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/MatchTarget.cs @@ -0,0 +1,62 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Automatically adjust the gameobject position and rotation so that the AvatarTarget reaches the matchPosition when the current state is at the specified progress. Returns Success.")] + public class MatchTarget : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The position we want the body part to reach")] + public SharedVector3 matchPosition; + [Tooltip("The rotation in which we want the body part to be")] + public SharedQuaternion matchRotation; + [Tooltip("The body part that is involved in the match")] + public AvatarTarget targetBodyPart; + [Tooltip("Weights for matching position")] + public Vector3 weightMaskPosition; + [Tooltip("Weights for matching rotation")] + public float weightMaskRotation; + [Tooltip("Start time within the animation clip")] + public float startNormalizedTime; + [Tooltip("End time within the animation clip")] + public float targetNormalizedTime = 1; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + animator.MatchTarget(matchPosition.Value, matchRotation.Value, targetBodyPart, new MatchTargetWeightMask(weightMaskPosition, weightMaskRotation), startNormalizedTime, targetNormalizedTime); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + matchPosition = Vector3.zero; + matchRotation = Quaternion.identity; + targetBodyPart = AvatarTarget.Root; + weightMaskPosition = Vector3.zero; + weightMaskRotation = 0; + startNormalizedTime = 0; + targetNormalizedTime = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/MatchTarget.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/MatchTarget.cs.meta new file mode 100644 index 000000000..6c9926983 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/MatchTarget.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e0e788b711539ed4dad258780be29de6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/MatchTarget.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/Play.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/Play.cs new file mode 100644 index 000000000..8dfc9729d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/Play.cs @@ -0,0 +1,50 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Plays an animator state. Returns Success.")] + public class Play : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the state")] + public SharedString stateName; + [Tooltip("The layer where the state is")] + public int layer = -1; + [Tooltip("The normalized time at which the state will play")] + public float normalizedTime = float.NegativeInfinity; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + animator.Play(stateName.Value, layer, normalizedTime); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + stateName = ""; + layer = -1; + normalizedTime = float.NegativeInfinity; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/Play.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/Play.cs.meta new file mode 100644 index 000000000..ee419a3d9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/Play.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a62df911d37cd8349b0168f875cd58ea +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/Play.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetApplyRootMotion.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetApplyRootMotion.cs new file mode 100644 index 000000000..62c764661 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetApplyRootMotion.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Sets if root motion is applied. Returns Success.")] + public class SetApplyRootMotion : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Is root motion applied?")] + public SharedBool rootMotion; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + animator.applyRootMotion = rootMotion.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + rootMotion = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetApplyRootMotion.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetApplyRootMotion.cs.meta new file mode 100644 index 000000000..9f4550ad9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetApplyRootMotion.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f10479b97efcbb94a8089a12bf891b5b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetApplyRootMotion.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetBoolParameter.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetBoolParameter.cs new file mode 100644 index 000000000..d1ac54aa5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetBoolParameter.cs @@ -0,0 +1,62 @@ +using UnityEngine; +using System.Collections; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Sets the bool parameter on an animator. Returns Success.")] + public class SetBoolParameter : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the parameter")] + public SharedString paramaterName; + [Tooltip("The value of the bool parameter")] + public SharedBool boolValue; + [Tooltip("Should the value be reverted back to its original value after it has been set?")] + public bool setOnce; + + private int hashID; + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + hashID = UnityEngine.Animator.StringToHash(paramaterName.Value); + + bool prevValue = animator.GetBool(hashID); + animator.SetBool(hashID, boolValue.Value); + if (setOnce) { + StartCoroutine(ResetValue(prevValue)); + } + return TaskStatus.Success; + } + + public IEnumerator ResetValue(bool origVale) + { + yield return null; + animator.SetBool(hashID, origVale); + } + + public override void OnReset() + { + targetGameObject = null; + paramaterName = ""; + boolValue = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetBoolParameter.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetBoolParameter.cs.meta new file mode 100644 index 000000000..d4304b2fd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetBoolParameter.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 04e0905e87bf90a408551067942c08c7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetBoolParameter.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetFloatParameter.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetFloatParameter.cs new file mode 100644 index 000000000..95c0416e4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetFloatParameter.cs @@ -0,0 +1,63 @@ +using UnityEngine; +using System.Collections; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Sets the float parameter on an animator. Returns Success.")] + public class SetFloatParameter : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the parameter")] + public SharedString paramaterName; + [Tooltip("The value of the float parameter")] + public SharedFloat floatValue; + [Tooltip("Should the value be reverted back to its original value after it has been set?")] + public bool setOnce; + + private int hashID; + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + hashID = UnityEngine.Animator.StringToHash(paramaterName.Value); + + float prevValue = animator.GetFloat(hashID); + animator.SetFloat(hashID, floatValue.Value); + if (setOnce) { + StartCoroutine(ResetValue(prevValue)); + } + + return TaskStatus.Success; + } + + public IEnumerator ResetValue(float origVale) + { + yield return null; + animator.SetFloat(hashID, origVale); + } + + public override void OnReset() + { + targetGameObject = null; + paramaterName = ""; + floatValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetFloatParameter.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetFloatParameter.cs.meta new file mode 100644 index 000000000..dd8dea59c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetFloatParameter.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b601abdc989d2ce4f8dc0d3434705814 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetFloatParameter.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetIntegerParameter.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetIntegerParameter.cs new file mode 100644 index 000000000..a065528de --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetIntegerParameter.cs @@ -0,0 +1,63 @@ +using UnityEngine; +using System.Collections; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Sets the int parameter on an animator. Returns Success.")] + public class SetIntegerParameter : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the parameter")] + public SharedString paramaterName; + [Tooltip("The value of the int parameter")] + public SharedInt intValue; + [Tooltip("Should the value be reverted back to its original value after it has been set?")] + public bool setOnce; + + private int hashID; + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + hashID = UnityEngine.Animator.StringToHash(paramaterName.Value); + + int prevValue = animator.GetInteger(hashID); + animator.SetInteger(hashID, intValue.Value); + if (setOnce) { + StartCoroutine(ResetValue(prevValue)); + } + + return TaskStatus.Success; + } + + public IEnumerator ResetValue(int origVale) + { + yield return null; + animator.SetInteger(hashID, origVale); + } + + public override void OnReset() + { + targetGameObject = null; + paramaterName = ""; + intValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetIntegerParameter.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetIntegerParameter.cs.meta new file mode 100644 index 000000000..63dbe2471 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetIntegerParameter.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 07345b9144172a74892b176413bf9ac3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetIntegerParameter.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLayerWeight.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLayerWeight.cs new file mode 100644 index 000000000..b391a45f4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLayerWeight.cs @@ -0,0 +1,47 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Sets the layer's current weight. Returns Success.")] + public class SetLayerWeight : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The layer's index")] + public SharedInt index; + [Tooltip("The weight of the layer")] + public SharedFloat weight; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + animator.SetLayerWeight(index.Value, weight.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + index = 0; + weight = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLayerWeight.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLayerWeight.cs.meta new file mode 100644 index 000000000..492ac4893 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLayerWeight.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 979ffd79261d4bb499331ba9fa80ed7d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLayerWeight.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLookAtPosition.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLookAtPosition.cs new file mode 100644 index 000000000..a65f32b0a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLookAtPosition.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Sets the look at position. Returns Success.")] + public class SetLookAtPosition : Action + { + [Tooltip("The position to lookAt")] + public SharedVector3 position; + + private Animator animator; + private bool positionSet; + + public override void OnStart() + { + animator = GetComponent(); + positionSet = false; + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + return positionSet ? TaskStatus.Success : TaskStatus.Running; + } + + public override void OnAnimatorIK() + { + if (animator == null) { + return; + } + animator.SetLookAtPosition(position.Value); + positionSet = true; + } + + public override void OnReset() + { + position = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLookAtPosition.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLookAtPosition.cs.meta new file mode 100644 index 000000000..a1c081c12 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLookAtPosition.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 31c4894aafa2b7f40984915713cff50b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLookAtPosition.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLookAtWeight.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLookAtWeight.cs new file mode 100644 index 000000000..37a2cdd9a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLookAtWeight.cs @@ -0,0 +1,58 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Sets the look at weight. Returns success immediately after.")] + public class SetLookAtWeight : Action + { + [Tooltip("(0-1) the global weight of the LookAt, multiplier for other parameters.")] + public SharedFloat weight; + [Tooltip("(0-1) determines how much the body is involved in the LookAt.")] + public float bodyWeight; + [Tooltip("(0-1) determines how much the head is involved in the LookAt.")] + public float headWeight = 1; + [Tooltip("(0-1) determines how much the eyes are involved in the LookAt.")] + public float eyesWeight; + [Tooltip("(0-1) 0.0 means the character is completely unrestrained in motion, 1.0 means he's completely clamped " + + "(look at becomes impossible), and 0.5 means he'll be able to move on half of the possible range (180 degrees).")] + public float clampWeight = 0.5f; + + private Animator animator; + private bool weightSet; + + public override void OnStart() + { + animator = GetComponent(); + weightSet = false; + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + return weightSet ? TaskStatus.Success : TaskStatus.Running; + } + + public override void OnAnimatorIK() + { + if (animator == null) { + return; + } + animator.SetLookAtWeight(weight.Value, bodyWeight, headWeight, eyesWeight, clampWeight); + weightSet = true; + } + + public override void OnReset() + { + weight = 0; + bodyWeight = 0; + headWeight = 1; + eyesWeight = 0; + clampWeight = 0.5f; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLookAtWeight.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLookAtWeight.cs.meta new file mode 100644 index 000000000..d3cf816f8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLookAtWeight.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1d700204dde35cd4c9e5a8553089127e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetLookAtWeight.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetSpeed.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetSpeed.cs new file mode 100644 index 000000000..14d10f998 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetSpeed.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Sets the playback speed of the Animator. 1 is normal playback speed. Returns Success.")] + public class SetSpeed : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The playback speed of the Animator")] + public SharedFloat speed; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + animator.speed = speed.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + speed = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetSpeed.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetSpeed.cs.meta new file mode 100644 index 000000000..e0cb732b5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetSpeed.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b5cd3c9afb48ee541afcce2dade6bc6a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetSpeed.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetTrigger.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetTrigger.cs new file mode 100644 index 000000000..92c0a8543 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetTrigger.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Sets a trigger parameter to active or inactive. Returns Success.")] + public class SetTrigger : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the parameter")] + public SharedString paramaterName; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + animator.SetTrigger(paramaterName.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + paramaterName = ""; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetTrigger.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetTrigger.cs.meta new file mode 100644 index 000000000..c5cafe468 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetTrigger.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 004807d2b68cad7459f6d84ce1274c16 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/SetTrigger.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StartPlayback.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StartPlayback.cs new file mode 100644 index 000000000..2a58808bc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StartPlayback.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Sets the animator in playback mode.")] + public class StartPlayback : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + animator.StartPlayback(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StartPlayback.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StartPlayback.cs.meta new file mode 100644 index 000000000..154550483 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StartPlayback.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 46d4b19160ba8774ea6100dda4288753 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StartPlayback.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StartRecording.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StartRecording.cs new file mode 100644 index 000000000..b79f55c65 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StartRecording.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Sets the animator in recording mode. Returns Success.")] + public class StartRecording : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The number of frames (updates) that will be recorded")] + public int frameCount; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + animator.StartRecording(frameCount); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + frameCount = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StartRecording.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StartRecording.cs.meta new file mode 100644 index 000000000..7fb19ee25 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StartRecording.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d6f14b502ed889444a0e44e8cb06e767 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StartRecording.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StopPlayback.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StopPlayback.cs new file mode 100644 index 000000000..ae9c23017 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StopPlayback.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Stops the animator playback mode. Returns Success.")] + public class StopPlayback : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + animator.StopPlayback(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StopPlayback.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StopPlayback.cs.meta new file mode 100644 index 000000000..acc8ca52d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StopPlayback.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7daa3c083e51ad44a8c8b05bb4e70689 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StopPlayback.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StopRecording.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StopRecording.cs new file mode 100644 index 000000000..6781273a4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StopRecording.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Stops animator record mode. Returns Success.")] + public class StopRecording : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private Animator animator; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + animator.StopRecording(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StopRecording.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StopRecording.cs.meta new file mode 100644 index 000000000..459f92da5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StopRecording.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c62c2817a5d72054caebff852d50ef17 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/StopRecording.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/WaitForState.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/WaitForState.cs new file mode 100644 index 000000000..c5a8f030c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/WaitForState.cs @@ -0,0 +1,60 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAnimator +{ + [TaskCategory("Unity/Animator")] + [TaskDescription("Waits for the Animator to reach the specified state.")] + public class WaitForState : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the state")] + public SharedString stateName; + [Tooltip("The layer where the state is")] + public SharedInt layer = -1; + + private Animator animator; + private GameObject prevGameObject; + private int stateHash; + + public override void OnAwake() + { + stateHash = Animator.StringToHash(stateName.Value); + } + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + animator = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + + if (!animator.HasState(layer.Value, stateHash)) { + Debug.LogError("Error: The Animator does not have the state " + stateName.Value + " on layer " + layer.Value); + } + } + } + + public override TaskStatus OnUpdate() + { + if (animator == null) { + Debug.LogWarning("Animator is null"); + return TaskStatus.Failure; + } + + var state = animator.GetCurrentAnimatorStateInfo(layer.Value); + if (state.shortNameHash == stateHash) { + return TaskStatus.Success; + } + + return TaskStatus.Running; + } + + public override void OnReset() + { + targetGameObject = null; + stateName = ""; + layer = -1; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/WaitForState.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/WaitForState.cs.meta new file mode 100644 index 000000000..09196a401 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/WaitForState.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: eff6d0a1593e4f7459f0194f9cbd79f1 +timeCreated: 1523364189 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Animator/WaitForState.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource.meta new file mode 100644 index 000000000..d08b44cca --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 8d2af13ebd5ef0b428b7ea2a3eb85c95 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetIgnoreListenerPause.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetIgnoreListenerPause.cs new file mode 100644 index 000000000..0a507ed83 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetIgnoreListenerPause.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Stores the ignore listener pause value of the AudioSource. Returns Success.")] + public class GetIgnoreListenerPause : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The ignore listener pause value of the AudioSource")] + [RequiredField] + public SharedBool storeValue; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + storeValue.Value = audioSource.ignoreListenerPause; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = false; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetIgnoreListenerPause.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetIgnoreListenerPause.cs.meta new file mode 100644 index 000000000..302b666d8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetIgnoreListenerPause.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b3bd7bb287fe91747bca60ebe3d53e87 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetIgnoreListenerPause.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetIgnoreListenerVolume.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetIgnoreListenerVolume.cs new file mode 100644 index 000000000..dd876c03e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetIgnoreListenerVolume.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Stores the ignore listener volume value of the AudioSource. Returns Success.")] + public class GetIgnoreListenerVolume : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The ignore listener volume value of the AudioSource")] + [RequiredField] + public SharedBool storeValue; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + storeValue.Value = audioSource.ignoreListenerVolume; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetIgnoreListenerVolume.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetIgnoreListenerVolume.cs.meta new file mode 100644 index 000000000..d342dac4f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetIgnoreListenerVolume.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c45986918364dfc4e9eca01d2839e2e4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetIgnoreListenerVolume.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetLoop.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetLoop.cs new file mode 100644 index 000000000..3cf01d574 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetLoop.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Stores the loop value of the AudioSource. Returns Success.")] + public class GetLoop : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The loop value of the AudioSource")] + [RequiredField] + public SharedBool storeValue; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + storeValue.Value = audioSource.loop; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetLoop.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetLoop.cs.meta new file mode 100644 index 000000000..d6ace896d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetLoop.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 699b9d0d798a219459c6477d2c21d4ba +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetLoop.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMaxDistance.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMaxDistance.cs new file mode 100644 index 000000000..07283960a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMaxDistance.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Stores the max distance value of the AudioSource. Returns Success.")] + public class GetMaxDistance : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The max distance value of the AudioSource")] + [RequiredField] + public SharedFloat storeValue; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + storeValue.Value = audioSource.maxDistance; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMaxDistance.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMaxDistance.cs.meta new file mode 100644 index 000000000..76301958f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMaxDistance.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3e2b2500d8e2b0c45825c0650f64eae2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMaxDistance.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMinDistance.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMinDistance.cs new file mode 100644 index 000000000..3d1051d22 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMinDistance.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Stores the min distance value of the AudioSource. Returns Success.")] + public class GetMinDistance : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The min distance value of the AudioSource")] + [RequiredField] + public SharedFloat storeValue; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + storeValue.Value = audioSource.minDistance; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMinDistance.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMinDistance.cs.meta new file mode 100644 index 000000000..6ea6e9d02 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMinDistance.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: cad762e82ef22644ca968b4a1c51eaec +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMinDistance.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMute.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMute.cs new file mode 100644 index 000000000..905bd8611 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMute.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Stores the mute value of the AudioSource. Returns Success.")] + public class GetMute : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The mute value of the AudioSource")] + [RequiredField] + public SharedBool storeValue; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + storeValue.Value = audioSource.mute; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMute.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMute.cs.meta new file mode 100644 index 000000000..a6900642a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMute.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 51df88b2df77e294cb673105b1c36961 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetMute.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetPitch.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetPitch.cs new file mode 100644 index 000000000..88aeb0d56 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetPitch.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Stores the pitch value of the AudioSource. Returns Success.")] + public class GetPitch : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The pitch value of the AudioSource")] + [RequiredField] + public SharedFloat storeValue; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + storeValue.Value = audioSource.pitch; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetPitch.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetPitch.cs.meta new file mode 100644 index 000000000..57f38eab9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetPitch.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 930fa7881ae9236449d90546f9922656 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetPitch.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetPriority.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetPriority.cs new file mode 100644 index 000000000..279d0326e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetPriority.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Stores the priority value of the AudioSource. Returns Success.")] + public class GetPriority : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The priority value of the AudioSource")] + [RequiredField] + public SharedInt storeValue; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + storeValue.Value = audioSource.priority; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetPriority.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetPriority.cs.meta new file mode 100644 index 000000000..3827911b8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetPriority.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: de856d580ad945e4d846fa52d3d647cc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetPriority.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetSpread.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetSpread.cs new file mode 100644 index 000000000..f105e8e5c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetSpread.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Stores the spread value of the AudioSource. Returns Success.")] + public class GetSpread : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The spread value of the AudioSource")] + [RequiredField] + public SharedFloat storeValue; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + storeValue.Value = audioSource.spread; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetSpread.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetSpread.cs.meta new file mode 100644 index 000000000..0deb3db4f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetSpread.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ba6a60eccf688514392e782348b84628 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetSpread.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetTime.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetTime.cs new file mode 100644 index 000000000..ccdb389ef --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetTime.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Stores the time value of the AudioSource. Returns Success.")] + public class GetTime : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The time value of the AudioSource")] + [RequiredField] + public SharedFloat storeValue; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + storeValue.Value = audioSource.time; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetTime.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetTime.cs.meta new file mode 100644 index 000000000..5cdc584eb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetTime.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 600c95fc760afa140bd0a7b98bd5071f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetTime.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetTimeSamples.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetTimeSamples.cs new file mode 100644 index 000000000..ea9023a12 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetTimeSamples.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Stores the time samples value of the AudioSource. Returns Success.")] + public class GetTimeSamples : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The time samples value of the AudioSource")] + [RequiredField] + public SharedFloat storeValue; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + storeValue.Value = audioSource.timeSamples; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetTimeSamples.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetTimeSamples.cs.meta new file mode 100644 index 000000000..7a6bac282 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetTimeSamples.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: af34adc5779f33442909ff32140dcdd4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetTimeSamples.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetVolume.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetVolume.cs new file mode 100644 index 000000000..4aa3bebe8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetVolume.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Stores the volume value of the AudioSource. Returns Success.")] + public class GetVolume : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The volume value of the AudioSource")] + [RequiredField] + public SharedFloat storeValue; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + storeValue.Value = audioSource.volume; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetVolume.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetVolume.cs.meta new file mode 100644 index 000000000..a0339d0aa --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetVolume.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: aad3b2c644baeb646b0b33b7317413d4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/GetVolume.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/IsPlaying.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/IsPlaying.cs new file mode 100644 index 000000000..839eb1e30 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/IsPlaying.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Returns Success if the AudioClip is playing, otherwise Failure.")] + public class IsPlaying : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + return audioSource.isPlaying ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/IsPlaying.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/IsPlaying.cs.meta new file mode 100644 index 000000000..1616fe482 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/IsPlaying.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 20fb79d98326b794fb309a291613cab4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/IsPlaying.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Pause.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Pause.cs new file mode 100644 index 000000000..cdce6ae34 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Pause.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Pauses the audio clip. Returns Success.")] + public class Pause : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.Pause(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Pause.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Pause.cs.meta new file mode 100644 index 000000000..3fdfd0448 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Pause.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 91db8dd58e79db745acc39f3f52da88e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Pause.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Play.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Play.cs new file mode 100644 index 000000000..f202e78b1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Play.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Plays the audio clip. Returns Success.")] + public class Play : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.Play(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Play.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Play.cs.meta new file mode 100644 index 000000000..bd082c2b0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Play.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7ac8cfb80c6a44c42b4ac4eef6f29bd5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Play.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayDelayed.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayDelayed.cs new file mode 100644 index 000000000..c93addb09 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayDelayed.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Plays the audio clip with a delay specified in seconds. Returns Success.")] + public class PlayDelayed : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Delay time specified in seconds")] + public SharedFloat delay = 0; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.PlayDelayed(delay.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + delay = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayDelayed.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayDelayed.cs.meta new file mode 100644 index 000000000..c1c10a62c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayDelayed.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 0125706a59bb7974eb3d425d3869779a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayDelayed.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayOneShot.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayOneShot.cs new file mode 100644 index 000000000..072f6f87e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayOneShot.cs @@ -0,0 +1,47 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Plays an AudioClip, and scales the AudioSource volume by volumeScale. Returns Success.")] + public class PlayOneShot : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The clip being played")] + public SharedObject clip; + [Tooltip("The scale of the volume (0-1)")] + public SharedFloat volumeScale = 1; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.PlayOneShot((AudioClip)clip.Value, volumeScale.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + clip = null; + volumeScale = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayOneShot.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayOneShot.cs.meta new file mode 100644 index 000000000..f0bc78ea0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayOneShot.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 112c969d16008464f96ce23aa5b32486 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayOneShot.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayScheduled.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayScheduled.cs new file mode 100644 index 000000000..edabd979e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayScheduled.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Plays the audio clip with a delay specified in seconds. Returns Success.")] + public class PlayScheduled : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Time in seconds on the absolute time-line that AudioSettings.dspTime refers to for when the sound should start playing")] + public SharedFloat time = 0; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.PlayScheduled(time.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + time = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayScheduled.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayScheduled.cs.meta new file mode 100644 index 000000000..4ca74061e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayScheduled.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 08d431471ffd8954197b88b698f0d424 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/PlayScheduled.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetAudioClip.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetAudioClip.cs new file mode 100644 index 000000000..91dbfe659 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetAudioClip.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Sets the clip value of the AudioSource. Returns Success.")] + public class SetAudioClip : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The AudioSource clip")] + public AudioClip audioClip; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.clip = audioClip; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + audioClip = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetAudioClip.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetAudioClip.cs.meta new file mode 100644 index 000000000..de97f0e16 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetAudioClip.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f52d9d404f7deab448e4f5c2bb3f7892 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetAudioClip.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetIgnoreListenerPause.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetIgnoreListenerPause.cs new file mode 100644 index 000000000..17456c106 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetIgnoreListenerPause.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Sets the ignore listener volume value of the AudioSource. Returns Success.")] + public class SetIgnoreListenerVolume : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The ignore listener volume value of the AudioSource")] + public SharedBool ignoreListenerVolume; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.ignoreListenerVolume = ignoreListenerVolume.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + ignoreListenerVolume = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetIgnoreListenerPause.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetIgnoreListenerPause.cs.meta new file mode 100644 index 000000000..1d6e108a1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetIgnoreListenerPause.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d617db8232463c444a8a3159da109798 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetIgnoreListenerPause.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetIgnoreListenerVolume.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetIgnoreListenerVolume.cs new file mode 100644 index 000000000..bd7fcf39d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetIgnoreListenerVolume.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Sets the ignore listener pause value of the AudioSource. Returns Success.")] + public class SetIgnoreListenerPause : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The ignore listener pause value of the AudioSource")] + public SharedBool ignoreListenerPause; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.ignoreListenerPause = ignoreListenerPause.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + ignoreListenerPause = false; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetIgnoreListenerVolume.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetIgnoreListenerVolume.cs.meta new file mode 100644 index 000000000..cf71855b9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetIgnoreListenerVolume.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6f1f5937bfa03484296c0fb5a9ce9b29 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetIgnoreListenerVolume.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetLoop.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetLoop.cs new file mode 100644 index 000000000..392521267 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetLoop.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Sets the loop value of the AudioSource. Returns Success.")] + public class SetLoop : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The loop value of the AudioSource")] + public SharedBool loop; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.loop = loop.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + loop = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetLoop.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetLoop.cs.meta new file mode 100644 index 000000000..12f8808fc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetLoop.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 50536bd6b5fa6924bb7217dd3b6e3f45 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetLoop.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMaxDistance.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMaxDistance.cs new file mode 100644 index 000000000..1d70c2755 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMaxDistance.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Sets the max distance value of the AudioSource. Returns Success.")] + public class SetMaxDistance : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The max distance value of the AudioSource")] + public SharedFloat maxDistance; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.maxDistance = maxDistance.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + maxDistance = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMaxDistance.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMaxDistance.cs.meta new file mode 100644 index 000000000..9819543b9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMaxDistance.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b0c75cf2afc289c4a8962f71b5e17dd1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMaxDistance.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMinDistance.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMinDistance.cs new file mode 100644 index 000000000..d747d5e7d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMinDistance.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Sets the min distance value of the AudioSource. Returns Success.")] + public class SetMinDistance : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The min distance value of the AudioSource")] + public SharedFloat minDistance; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.minDistance = minDistance.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + minDistance = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMinDistance.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMinDistance.cs.meta new file mode 100644 index 000000000..d16b6cb72 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMinDistance.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ccb3beba9296fc54d8427cd646af4f4e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMinDistance.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMute.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMute.cs new file mode 100644 index 000000000..f78355581 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMute.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Sets the mute value of the AudioSource. Returns Success.")] + public class SetMute : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The mute value of the AudioSource")] + public SharedBool mute; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.mute = mute.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + mute = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMute.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMute.cs.meta new file mode 100644 index 000000000..6810767ac --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMute.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ec553c7ad9360a24fb7ce3bf3bc48c97 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetMute.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetPitch.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetPitch.cs new file mode 100644 index 000000000..c3efee44d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetPitch.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Sets the pitch value of the AudioSource. Returns Success.")] + public class SetPitch : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The pitch value of the AudioSource")] + public SharedFloat pitch; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.pitch = pitch.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + pitch = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetPitch.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetPitch.cs.meta new file mode 100644 index 000000000..79d48b03e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetPitch.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3c7615ddc4e92fd41b72de06f039f9e1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetPitch.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetPriority.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetPriority.cs new file mode 100644 index 000000000..ffd158441 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetPriority.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Sets the priority value of the AudioSource. Returns Success.")] + public class SetPriority : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The priority value of the AudioSource")] + public SharedInt priority; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.priority = priority.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + priority = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetPriority.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetPriority.cs.meta new file mode 100644 index 000000000..22ed0c93a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetPriority.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4fc15622e17101f4b95be39910433c8a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetPriority.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetRolloffMode.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetRolloffMode.cs new file mode 100644 index 000000000..0a25308b9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetRolloffMode.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Sets the rolloff mode of the AudioSource. Returns Success.")] + public class SetRolloffMode : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The rolloff mode of the AudioSource")] + public AudioRolloffMode rolloffMode; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.rolloffMode = rolloffMode; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + rolloffMode = AudioRolloffMode.Logarithmic; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetRolloffMode.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetRolloffMode.cs.meta new file mode 100644 index 000000000..27f5596b5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetRolloffMode.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ef88d71b5b7e0a84d98bde6405eb294d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetRolloffMode.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetScheduledEndTime.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetScheduledEndTime.cs new file mode 100644 index 000000000..20c149ff2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetScheduledEndTime.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Changes the time at which a sound that has already been scheduled to play will end. Notice that depending on the " + + "timing not all rescheduling requests can be fulfilled. Returns Success.")] + public class SetScheduledEndTime : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Time in seconds")] + public SharedFloat time = 0; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.SetScheduledEndTime(time.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + time = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetScheduledEndTime.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetScheduledEndTime.cs.meta new file mode 100644 index 000000000..dcf745d6f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetScheduledEndTime.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8867d64aa9a2add4f913b8b5faa9d1ce +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetScheduledEndTime.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetScheduledStartTime.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetScheduledStartTime.cs new file mode 100644 index 000000000..be0f696cf --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetScheduledStartTime.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Changes the time at which a sound that has already been scheduled to play will start. Returns Success.")] + public class SetScheduledStartTime : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Time in seconds")] + public SharedFloat time = 0; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.SetScheduledStartTime(time.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + time = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetScheduledStartTime.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetScheduledStartTime.cs.meta new file mode 100644 index 000000000..cc4f35284 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetScheduledStartTime.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: cf64b74120564064a8d9c622ccc7115a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetScheduledStartTime.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetSpread.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetSpread.cs new file mode 100644 index 000000000..dbf2cbd00 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetSpread.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Sets the spread value of the AudioSource. Returns Success.")] + public class SetSpread : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The spread value of the AudioSource")] + public SharedFloat spread; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.spread = spread.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + spread = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetSpread.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetSpread.cs.meta new file mode 100644 index 000000000..65f746b6b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetSpread.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f6d964d5fdf24bf449d3f59de1864dd8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetSpread.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetTime.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetTime.cs new file mode 100644 index 000000000..b1521044b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetTime.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Sets the time value of the AudioSource. Returns Success.")] + public class SetTime : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The time value of the AudioSource")] + public SharedFloat time; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.time = time.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + time = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetTime.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetTime.cs.meta new file mode 100644 index 000000000..d1135e561 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetTime.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3173ce3fda9d60f48b159759f8981f89 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetTime.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetVelocityUpdateMode.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetVelocityUpdateMode.cs new file mode 100644 index 000000000..95edb9793 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetVelocityUpdateMode.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Sets the rolloff mode of the AudioSource. Returns Success.")] + public class SetVelocityUpdateMode : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The velocity update mode of the AudioSource")] + public AudioVelocityUpdateMode velocityUpdateMode; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.velocityUpdateMode = velocityUpdateMode; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + velocityUpdateMode = AudioVelocityUpdateMode.Auto; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetVelocityUpdateMode.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetVelocityUpdateMode.cs.meta new file mode 100644 index 000000000..e2467cc22 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetVelocityUpdateMode.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c26ea6b22d3fa7843a73e5088376996c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetVelocityUpdateMode.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetVolume.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetVolume.cs new file mode 100644 index 000000000..0ae195400 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetVolume.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Sets the volume value of the AudioSource. Returns Success.")] + public class SetVolume : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The volume value of the AudioSource")] + public SharedFloat volume; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.volume = volume.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + volume = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetVolume.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetVolume.cs.meta new file mode 100644 index 000000000..5a4d12fbd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetVolume.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: edfc39045c7af164fb340d21762e4d79 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/SetVolume.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Stop.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Stop.cs new file mode 100644 index 000000000..ab5fdf42a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Stop.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityAudioSource +{ + [TaskCategory("Unity/AudioSource")] + [TaskDescription("Stops playing the audio clip. Returns Success.")] + public class Stop : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private AudioSource audioSource; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + audioSource = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (audioSource == null) { + Debug.LogWarning("AudioSource is null"); + return TaskStatus.Failure; + } + + audioSource.Stop(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Stop.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Stop.cs.meta new file mode 100644 index 000000000..729372d81 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Stop.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: bd4cec1e9e81e664d8e7782bd02bcade +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/AudioSource/Stop.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour.meta new file mode 100644 index 000000000..9d3d4dcfd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 51de5dc2234f2d642b8b53dd9ccc9be3 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/GetEnabled.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/GetEnabled.cs new file mode 100644 index 000000000..296542bca --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/GetEnabled.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityBehaviour +{ + [TaskCategory("Unity/Behaviour")] + [TaskDescription("Stores the enabled state of the object. Returns Success.")] + public class GetEnabled : Action + { + [Tooltip("The Behavior to use")] + public SharedBehaviour specifiedObject; + [Tooltip("The enabled/disabled state")] + [RequiredField] + public SharedBool storeValue; + + public override TaskStatus OnUpdate() + { + if (specifiedObject == null) { + Debug.LogWarning("SpecifiedObject is null"); + return TaskStatus.Failure; + } + + storeValue.Value = specifiedObject.Value.enabled; + + return TaskStatus.Success; + } + + public override void OnReset() + { + specifiedObject.Value = null; + storeValue = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/GetEnabled.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/GetEnabled.cs.meta new file mode 100644 index 000000000..e33fb8727 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/GetEnabled.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ad6519dede06d7b46b95e54bb60be281 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/GetEnabled.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/IsEnabled.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/IsEnabled.cs new file mode 100644 index 000000000..c3e8c5523 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/IsEnabled.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityBehaviour +{ + [TaskCategory("Unity/Behaviour")] + [TaskDescription("Returns Success if the object is enabled, otherwise Failure.")] + public class IsEnabled : Conditional + { + [Tooltip("The Object to use")] + public SharedObject specifiedObject; + + public override TaskStatus OnUpdate() + { + if (specifiedObject == null && !(specifiedObject.Value is UnityEngine.Behaviour)) { + Debug.LogWarning("SpecifiedObject is null or not a subclass of UnityEngine.Behaviour"); + return TaskStatus.Failure; + } + + return (specifiedObject.Value as Behaviour).enabled ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + if (specifiedObject != null) { + specifiedObject.Value = null; + } + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/IsEnabled.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/IsEnabled.cs.meta new file mode 100644 index 000000000..c99d8e7b3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/IsEnabled.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 32f61cbdb8bdf1e44bf418ca21681bc3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/IsEnabled.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/SetEnabled.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/SetEnabled.cs new file mode 100644 index 000000000..4d70712c5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/SetEnabled.cs @@ -0,0 +1,32 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityBehaviour +{ + [TaskCategory("Unity/Behaviour")] + [TaskDescription("Enables/Disables the object. Returns Success.")] + public class SetEnabled : Action + { + [Tooltip("The Behavior to use")] + public SharedBehaviour specifiedObject; + [Tooltip("The enabled/disabled state")] + public SharedBool enabled; + + public override TaskStatus OnUpdate() + { + if (specifiedObject == null) { + Debug.LogWarning("SpecifiedObject is null"); + return TaskStatus.Failure; + } + + specifiedObject.Value.enabled = enabled.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + specifiedObject.Value = null; + enabled = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/SetEnabled.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/SetEnabled.cs.meta new file mode 100644 index 000000000..393b55834 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/SetEnabled.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: cf7703ff7e9055e4f811a5b95bf18930 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Behaviour/SetEnabled.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider.meta new file mode 100644 index 000000000..6791afaa8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 876af1fbcf3642e4b987507ed975a15a +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/GetCenter.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/GetCenter.cs new file mode 100644 index 000000000..3173fcfd2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/GetCenter.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityBoxCollider +{ + [TaskCategory("Unity/BoxCollider")] + [TaskDescription("Stores the center of the BoxCollider. 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 BoxCollider")] + [RequiredField] + public SharedVector3 storeValue; + + private BoxCollider boxCollider; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + boxCollider = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (boxCollider == null) { + Debug.LogWarning("BoxCollider is null"); + return TaskStatus.Failure; + } + + storeValue.Value = boxCollider.center; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/GetCenter.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/GetCenter.cs.meta new file mode 100644 index 000000000..b9b6a986b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/GetCenter.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9c3ae13d2bd0e5f4186835c672d9461f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/GetCenter.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/GetSize.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/GetSize.cs new file mode 100644 index 000000000..ac1229175 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/GetSize.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityBoxCollider +{ + [TaskCategory("Unity/BoxCollider")] + [TaskDescription("Stores the size of the BoxCollider. 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 BoxCollider")] + [RequiredField] + public SharedVector3 storeValue; + + private BoxCollider boxCollider; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + boxCollider = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (boxCollider == null) { + Debug.LogWarning("BoxCollider is null"); + return TaskStatus.Failure; + } + + storeValue.Value = boxCollider.size; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/GetSize.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/GetSize.cs.meta new file mode 100644 index 000000000..683c5416d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/GetSize.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 0afec21454700d3479c4f9767f9382f9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/GetSize.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/SetCenter.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/SetCenter.cs new file mode 100644 index 000000000..7731b60cb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/SetCenter.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityBoxCollider +{ + [TaskCategory("Unity/BoxCollider")] + [TaskDescription("Sets the center of the BoxCollider. 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 BoxCollider")] + public SharedVector3 center; + + private BoxCollider boxCollider; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + boxCollider = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (boxCollider == null) { + Debug.LogWarning("BoxCollider is null"); + return TaskStatus.Failure; + } + + boxCollider.center = center.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + center = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/SetCenter.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/SetCenter.cs.meta new file mode 100644 index 000000000..54f65cc9c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/SetCenter.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 45b3b4dc79247bd46a9c2b11fa9b125c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/SetCenter.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/SetSize.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/SetSize.cs new file mode 100644 index 000000000..82e8b9247 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/SetSize.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityBoxCollider +{ + [TaskCategory("Unity/BoxCollider")] + [TaskDescription("Sets the size of the BoxCollider. 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 BoxCollider")] + public SharedVector3 size; + + private BoxCollider boxCollider; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + boxCollider = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (boxCollider == null) { + Debug.LogWarning("BoxCollider is null"); + return TaskStatus.Failure; + } + + boxCollider.size = size.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + size = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/SetSize.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/SetSize.cs.meta new file mode 100644 index 000000000..a4ede0d85 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/SetSize.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d899b6ed83f6e264f8e5867cf68c0cda +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider/SetSize.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D.meta new file mode 100644 index 000000000..8093c213a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c7814e7f18119144182f77f9b2a01af2 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D/GetSize.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D/GetSize.cs new file mode 100644 index 000000000..b35253748 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D/GetSize.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityBoxCollider2D +{ + [TaskCategory("Unity/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(); + 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/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D/GetSize.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D/GetSize.cs.meta new file mode 100644 index 000000000..10bdf0f1c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D/GetSize.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c69113b787759f340aacbb9d99a6d654 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D/GetSize.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D/SetSize.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D/SetSize.cs new file mode 100644 index 000000000..b58f42b5e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D/SetSize.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityBoxCollider2D +{ + [TaskCategory("Unity/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(); + 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/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D/SetSize.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D/SetSize.cs.meta new file mode 100644 index 000000000..572b2e1d9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D/SetSize.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1875fd00045d98848b028015a17aeeaf +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/BoxCollider2D/SetSize.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider.meta new file mode 100644 index 000000000..d777955b1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 0cf43865b0892fb48ac285f63910ff97 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetCenter.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetCenter.cs new file mode 100644 index 000000000..b9790068b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetCenter.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCapsuleCollider +{ + [TaskCategory("Unity/CapsuleCollider")] + [TaskDescription("Stores the center of the CapsuleCollider. 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 CapsuleCollider")] + [RequiredField] + public SharedVector3 storeValue; + + private CapsuleCollider capsuleCollider; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + capsuleCollider = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (capsuleCollider == null) { + Debug.LogWarning("CapsuleCollider is null"); + return TaskStatus.Failure; + } + + storeValue.Value = capsuleCollider.center; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetCenter.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetCenter.cs.meta new file mode 100644 index 000000000..7c7e662f1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetCenter.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3a032cb4c0b97b844ad53ad7bb2617c3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetCenter.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetDirection.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetDirection.cs new file mode 100644 index 000000000..84e8301ce --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetDirection.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCapsuleCollider +{ + [TaskCategory("Unity/CapsuleCollider")] + [TaskDescription("Stores the direction of the CapsuleCollider. Returns Success.")] + public class GetDirection : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The direction of the CapsuleCollider")] + [RequiredField] + public SharedInt storeValue; + + private CapsuleCollider capsuleCollider; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + capsuleCollider = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (capsuleCollider == null) { + Debug.LogWarning("CapsuleCollider is null"); + return TaskStatus.Failure; + } + + storeValue.Value = capsuleCollider.direction; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetDirection.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetDirection.cs.meta new file mode 100644 index 000000000..cca6c6835 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetDirection.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7e9f2ebb599281345a458fab17aab5fd +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetDirection.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetHeight.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetHeight.cs new file mode 100644 index 000000000..2028892ee --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetHeight.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCapsuleCollider +{ + [TaskCategory("Unity/CapsuleCollider")] + [TaskDescription("Gets the height of the CapsuleCollider. Returns Success.")] + public class GetHeight : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The height of the CapsuleCollider")] + [RequiredField] + public SharedFloat storeValue; + + private CapsuleCollider capsuleCollider; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + capsuleCollider = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (capsuleCollider == null) { + Debug.LogWarning("CapsuleCollider is null"); + return TaskStatus.Failure; + } + + storeValue.Value = capsuleCollider.height; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetHeight.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetHeight.cs.meta new file mode 100644 index 000000000..3aebcd5fe --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetHeight.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 29e860749600e174aa61dd42be0a3126 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetHeight.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetRadius.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetRadius.cs new file mode 100644 index 000000000..a4893726b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetRadius.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCapsuleCollider +{ + [TaskCategory("Unity/CapsuleCollider")] + [TaskDescription("Stores the radius of the CapsuleCollider. 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 CapsuleCollider")] + [RequiredField] + public SharedFloat storeValue; + + private CapsuleCollider capsuleCollider; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + capsuleCollider = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (capsuleCollider == null) { + Debug.LogWarning("CapsuleCollider is null"); + return TaskStatus.Failure; + } + + storeValue.Value = capsuleCollider.radius; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetRadius.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetRadius.cs.meta new file mode 100644 index 000000000..563a50c5a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetRadius.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d03b50a6f076c75408ef6e843bd75539 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/GetRadius.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetCenter.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetCenter.cs new file mode 100644 index 000000000..edc0ede4b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetCenter.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCapsuleCollider +{ + [TaskCategory("Unity/CapsuleCollider")] + [TaskDescription("Sets the center of the CapsuleCollider. 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 CapsuleCollider")] + public SharedVector3 center; + + private CapsuleCollider capsuleCollider; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + capsuleCollider = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (capsuleCollider == null) { + Debug.LogWarning("CapsuleCollider is null"); + return TaskStatus.Failure; + } + + capsuleCollider.center = center.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + center = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetCenter.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetCenter.cs.meta new file mode 100644 index 000000000..389947a23 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetCenter.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f8292285661aa7e4086c0b59926632c3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetCenter.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetDirection.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetDirection.cs new file mode 100644 index 000000000..f4a8c729d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetDirection.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCapsuleCollider +{ + [TaskCategory("Unity/CapsuleCollider")] + [TaskDescription("Sets the direction of the CapsuleCollider. Returns Success.")] + public class SetDirection : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The direction of the CapsuleCollider")] + public SharedInt direction; + + private CapsuleCollider capsuleCollider; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + capsuleCollider = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (capsuleCollider == null) { + Debug.LogWarning("CapsuleCollider is null"); + return TaskStatus.Failure; + } + + capsuleCollider.direction = direction.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + direction = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetDirection.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetDirection.cs.meta new file mode 100644 index 000000000..299e6d1b2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetDirection.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4146b45b3a598294f86dbbac03e6e8cb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetDirection.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetHeight.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetHeight.cs new file mode 100644 index 000000000..18906ddfc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetHeight.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCapsuleCollider +{ + [TaskCategory("Unity/CapsuleCollider")] + [TaskDescription("Sets the height of the CapsuleCollider. Returns Success.")] + public class SetHeight : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The height of the CapsuleCollider")] + public SharedFloat direction; + + private CapsuleCollider capsuleCollider; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + capsuleCollider = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (capsuleCollider == null) { + Debug.LogWarning("CapsuleCollider is null"); + return TaskStatus.Failure; + } + + capsuleCollider.height = direction.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + direction = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetHeight.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetHeight.cs.meta new file mode 100644 index 000000000..2721c5dba --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetHeight.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 34f947c079c1159488c80854ee53ecd8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetHeight.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetRadius.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetRadius.cs new file mode 100644 index 000000000..16c15b8d9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetRadius.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCapsuleCollider +{ + [TaskCategory("Unity/CapsuleCollider")] + [TaskDescription("Sets the radius of the CapsuleCollider. 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 CapsuleCollider")] + public SharedFloat radius; + + private CapsuleCollider capsuleCollider; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + capsuleCollider = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (capsuleCollider == null) { + Debug.LogWarning("CapsuleCollider is null"); + return TaskStatus.Failure; + } + + capsuleCollider.radius = radius.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + radius = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetRadius.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetRadius.cs.meta new file mode 100644 index 000000000..eb7727b34 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetRadius.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fed5a0f5604af324cb2e4a3ed9315793 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CapsuleCollider/SetRadius.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController.meta new file mode 100644 index 000000000..65989b5c0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4b58bcba0c40cfc448a1f2a5f2a57c57 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetCenter.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetCenter.cs new file mode 100644 index 000000000..1e2769b73 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetCenter.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCharacterController +{ + [TaskCategory("Unity/CharacterController")] + [TaskDescription("Stores the center of the CharacterController. 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 CharacterController")] + [RequiredField] + public SharedVector3 storeValue; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + storeValue.Value = characterController.center; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetCenter.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetCenter.cs.meta new file mode 100644 index 000000000..9f5824e25 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetCenter.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e4033e3d9c7ef994ba600b3afec28a0d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetCenter.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetHeight.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetHeight.cs new file mode 100644 index 000000000..8a01b4985 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetHeight.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCharacterController +{ + [TaskCategory("Unity/CharacterController")] + [TaskDescription("Stores the height of the CharacterController. Returns Success.")] + public class GetHeight : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The height of the CharacterController")] + [RequiredField] + public SharedFloat storeValue; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + storeValue.Value = characterController.height; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetHeight.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetHeight.cs.meta new file mode 100644 index 000000000..451e9c976 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetHeight.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: eec31e6d5685c674fa2952757b4adf9a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetHeight.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetRadius.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetRadius.cs new file mode 100644 index 000000000..217991121 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetRadius.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCharacterController +{ + [TaskCategory("Unity/CharacterController")] + [TaskDescription("Stores the radius of the CharacterController. 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 CharacterController")] + [RequiredField] + public SharedFloat storeValue; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + storeValue.Value = characterController.radius; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetRadius.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetRadius.cs.meta new file mode 100644 index 000000000..b0e66289b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetRadius.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3bf330244cdea3b43ad95e8731fdb78b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetRadius.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetSlopeLimit.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetSlopeLimit.cs new file mode 100644 index 000000000..bc936a67a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetSlopeLimit.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCharacterController +{ + [TaskCategory("Unity/CharacterController")] + [TaskDescription("Stores the slope limit of the CharacterController. Returns Success.")] + public class GetSlopeLimit : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The slope limit of the CharacterController")] + [RequiredField] + public SharedFloat storeValue; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + storeValue.Value = characterController.slopeLimit; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetSlopeLimit.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetSlopeLimit.cs.meta new file mode 100644 index 000000000..15472b098 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetSlopeLimit.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3cb445c34dce1a14aa5134278025ec59 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetSlopeLimit.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetStepOffset.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetStepOffset.cs new file mode 100644 index 000000000..348d4f0d1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetStepOffset.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCharacterController +{ + [TaskCategory("Unity/CharacterController")] + [TaskDescription("Stores the step offset of the CharacterController. Returns Success.")] + public class GetStepOffset : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The step offset of the CharacterController")] + [RequiredField] + public SharedFloat storeValue; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + storeValue.Value = characterController.stepOffset; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetStepOffset.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetStepOffset.cs.meta new file mode 100644 index 000000000..46faacf83 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetStepOffset.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d9bb8d4be247f4d4cb9b2b05a6efd48f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetStepOffset.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetVelocity.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetVelocity.cs new file mode 100644 index 000000000..ada878ad2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetVelocity.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCharacterController +{ + [TaskCategory("Unity/CharacterController")] + [TaskDescription("Stores the velocity of the CharacterController. Returns Success.")] + public class GetVelocity : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The velocity of the CharacterController")] + [RequiredField] + public SharedVector3 storeValue; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + storeValue.Value = characterController.velocity; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetVelocity.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetVelocity.cs.meta new file mode 100644 index 000000000..f42f935f9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetVelocity.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 783c920567425bd4c9385eeaf8099ea4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/GetVelocity.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/HasColliderHit.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/HasColliderHit.cs new file mode 100644 index 000000000..0eea0801c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/HasColliderHit.cs @@ -0,0 +1,43 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCharacterController +{ + [TaskCategory("Unity/CharacterController")] + [TaskDescription("Returns Success if the collider hit another object, otherwise Failure.")] + public class HasColliderHit : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [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 OnControllerColliderHit(ControllerColliderHit hit) + { + if (string.IsNullOrEmpty(tag.Value) || tag.Value.Equals(hit.gameObject.tag)) { + collidedGameObject.Value = hit.gameObject; + enteredCollision = true; + } + } + + public override void OnReset() + { + targetGameObject = null; + tag = ""; + collidedGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/HasColliderHit.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/HasColliderHit.cs.meta new file mode 100644 index 000000000..2ac02a3c2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/HasColliderHit.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9ff7c43d9df5279489455a4ce2eb3b20 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/HasColliderHit.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/IsGrounded.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/IsGrounded.cs new file mode 100644 index 000000000..076cc3c32 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/IsGrounded.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCharacterController +{ + [TaskCategory("Unity/CharacterController")] + [TaskDescription("Returns Success if the character is grounded, otherwise Failure.")] + public class IsGrounded : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + return characterController.isGrounded ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/IsGrounded.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/IsGrounded.cs.meta new file mode 100644 index 000000000..7ea4304ee --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/IsGrounded.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e8541a996b0a37b4f8bce82dd23ddb84 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/IsGrounded.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/Move.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/Move.cs new file mode 100644 index 000000000..ec9de4339 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/Move.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCharacterController +{ + [TaskCategory("Unity/CharacterController")] + [TaskDescription("A more complex move function taking absolute movement deltas. Returns Success.")] + public class Move : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The amount to move")] + public SharedVector3 motion; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + characterController.Move(motion.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + motion = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/Move.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/Move.cs.meta new file mode 100644 index 000000000..ad43462ff --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/Move.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 546770f14f8265d4c83b94210630b644 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/Move.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetCenter.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetCenter.cs new file mode 100644 index 000000000..58d527cdb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetCenter.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCharacterController +{ + [TaskCategory("Unity/CharacterController")] + [TaskDescription("Sets the center of the CharacterController. 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 CharacterController")] + public SharedVector3 center; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + characterController.center = center.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + center = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetCenter.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetCenter.cs.meta new file mode 100644 index 000000000..7b4681340 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetCenter.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1072c5d1f7d15b24d811ee2e52f5806f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetCenter.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetHeight.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetHeight.cs new file mode 100644 index 000000000..83020a356 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetHeight.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCharacterController +{ + [TaskCategory("Unity/CharacterController")] + [TaskDescription("Sets the height of the CharacterController. Returns Success.")] + public class SetHeight : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The height of the CharacterController")] + public SharedFloat height; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + characterController.height = height.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + height = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetHeight.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetHeight.cs.meta new file mode 100644 index 000000000..34e72fd3b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetHeight.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f3646fc892390f443ab43e4313cd0c6a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetHeight.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetRadius.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetRadius.cs new file mode 100644 index 000000000..acf866e9e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetRadius.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCharacterController +{ + [TaskCategory("Unity/CharacterController")] + [TaskDescription("Sets the radius of the CharacterController. 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 CharacterController")] + public SharedFloat radius; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + characterController.radius = radius.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + radius = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetRadius.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetRadius.cs.meta new file mode 100644 index 000000000..073768f7a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetRadius.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d3d7c584aef3bd5468165685a1975862 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetRadius.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetSlopeLimit.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetSlopeLimit.cs new file mode 100644 index 000000000..f265d1ac0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetSlopeLimit.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCharacterController +{ + [TaskCategory("Unity/CharacterController")] + [TaskDescription("Sets the slope limit of the CharacterController. Returns Success.")] + public class SetSlopeLimit : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The slope limit of the CharacterController")] + public SharedFloat slopeLimit; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + characterController.slopeLimit = slopeLimit.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + slopeLimit = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetSlopeLimit.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetSlopeLimit.cs.meta new file mode 100644 index 000000000..72c65c003 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetSlopeLimit.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 65d4ccec4c868584a89d9037a6eec3e6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetSlopeLimit.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetStepOffset.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetStepOffset.cs new file mode 100644 index 000000000..4696d64fc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetStepOffset.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCharacterController +{ + [TaskCategory("Unity/CharacterController")] + [TaskDescription("Sets the step offset of the CharacterController. Returns Success.")] + public class SetStepOffset : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The step offset of the CharacterController")] + public SharedFloat stepOffset; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + characterController.stepOffset = stepOffset.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + stepOffset = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetStepOffset.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetStepOffset.cs.meta new file mode 100644 index 000000000..306c9812b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetStepOffset.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b062e83de9feb8a41a9e4989f2d65b97 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SetStepOffset.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SimpleMove.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SimpleMove.cs new file mode 100644 index 000000000..ccd853e25 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SimpleMove.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCharacterController +{ + [TaskCategory("Unity/CharacterController")] + [TaskDescription("Moves the character with speed. Returns Success.")] + public class SimpleMove : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The speed of the movement")] + public SharedVector3 speed; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + characterController.SimpleMove(speed.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + speed = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SimpleMove.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SimpleMove.cs.meta new file mode 100644 index 000000000..e8dbaa51f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SimpleMove.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c760a29b8a35c044d87b7a80a58f046c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CharacterController/SimpleMove.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D.meta new file mode 100644 index 000000000..bde0971a6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: e179f1af407aa8b469c6d96d7c0e2563 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/GetOffset.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/GetOffset.cs new file mode 100644 index 000000000..f1e0d2f76 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/GetOffset.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCircleCollider2D +{ + [TaskCategory("Unity/CircleCollider2D")] + [TaskDescription("Stores the offset of the CircleCollider2D. Returns Success.")] + public class GetOffset : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The offset of the CircleCollider2D")] + [RequiredField] + public SharedVector3 storeValue; + + private CircleCollider2D circleCollider2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + circleCollider2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (circleCollider2D == null) { + Debug.LogWarning("CircleCollider2D is null"); + return TaskStatus.Failure; + } + + storeValue.Value = circleCollider2D.offset; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/GetOffset.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/GetOffset.cs.meta new file mode 100644 index 000000000..eec42c212 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/GetOffset.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 336c692acc5ff024988b77803ca15fac +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/GetOffset.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/GetRadius.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/GetRadius.cs new file mode 100644 index 000000000..24f5f05a2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/GetRadius.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCircleCollider2D +{ + [TaskCategory("Unity/CircleCollider2D")] + [TaskDescription("Stores the radius of the CircleCollider2D. 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 CircleCollider2D")] + [RequiredField] + public SharedFloat storeValue; + + private CircleCollider2D circleCollider2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + circleCollider2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (circleCollider2D == null) { + Debug.LogWarning("CircleCollider2D is null"); + return TaskStatus.Failure; + } + + storeValue.Value = circleCollider2D.radius; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/GetRadius.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/GetRadius.cs.meta new file mode 100644 index 000000000..18d7ada05 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/GetRadius.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5301adcc69414e44681c1d4dc7ecde58 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/GetRadius.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/SetOffset.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/SetOffset.cs new file mode 100644 index 000000000..c82abcfac --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/SetOffset.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCircleCollider2D +{ + [TaskCategory("Unity/CircleCollider2D")] + [TaskDescription("Sets the offset of the CircleCollider2D. Returns Success.")] + public class SetOffset : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The offset of the CircleCollider2D")] + public SharedVector3 offset; + + private CircleCollider2D circleCollider2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + circleCollider2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (circleCollider2D == null) { + Debug.LogWarning("CircleCollider2D is null"); + return TaskStatus.Failure; + } + + circleCollider2D.offset = offset.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + offset = Vector3.zero; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/SetOffset.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/SetOffset.cs.meta new file mode 100644 index 000000000..64390fe14 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/SetOffset.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6784dbe1d7c00c44bbd9ec3557c10053 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/SetOffset.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/SetRadius.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/SetRadius.cs new file mode 100644 index 000000000..3613f5183 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/SetRadius.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityCircleCollider2D +{ + [TaskCategory("Unity/CircleCollider2D")] + [TaskDescription("Sets the radius of the CircleCollider2D. 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 CircleCollider2D")] + public SharedFloat radius; + + private CircleCollider2D circleCollider2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + circleCollider2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (circleCollider2D == null) { + Debug.LogWarning("CircleCollider2D is null"); + return TaskStatus.Failure; + } + + circleCollider2D.radius = radius.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + radius = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/SetRadius.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/SetRadius.cs.meta new file mode 100644 index 000000000..ebb68ff82 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/SetRadius.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a9f837093c996864d95d92cae654a8ba +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/CircleCollider2D/SetRadius.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Collider.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Collider.meta new file mode 100644 index 000000000..ce4182fde --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Collider.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: cb2dc414c7a533a4da3e56a73ffae66a +folderAsset: yes +timeCreated: 1567507235 +licenseType: Store +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Collider/GetEnabled.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Collider/GetEnabled.cs new file mode 100644 index 000000000..9f37e3ae6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Collider/GetEnabled.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Collider +{ + [TaskCategory("Unity/Collider")] + [TaskDescription("Stores the enabled state of the collider. Returns Success.")] + public class GetEnabled : Action + { + [Tooltip("The Collider to use")] + public SharedCollider specifiedCollider; + [Tooltip("The enabled/disabled state")] + [RequiredField] + public SharedBool storeValue; + + public override TaskStatus OnUpdate() + { + if (specifiedCollider == null) { + Debug.LogWarning("SpecifiedObject is null"); + return TaskStatus.Failure; + } + + storeValue.Value = specifiedCollider.Value.enabled; + + return TaskStatus.Success; + } + + public override void OnReset() + { + specifiedCollider.Value = null; + storeValue = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Collider/GetEnabled.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Collider/GetEnabled.cs.meta new file mode 100644 index 000000000..2c6a30c46 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Collider/GetEnabled.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5c25d5e795c9ec5498489871de79c3b4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Collider/GetEnabled.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Collider/SetEnabled.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Collider/SetEnabled.cs new file mode 100644 index 000000000..3c2bcff85 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Collider/SetEnabled.cs @@ -0,0 +1,32 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Collider +{ + [TaskCategory("Unity/Collider")] + [TaskDescription("Enables/Disables the collider. Returns Success.")] + public class SetEnabled : Action + { + [Tooltip("The Behavior to use")] + public SharedCollider specifiedCollider; + [Tooltip("The enabled/disabled state")] + public SharedBool enabled; + + public override TaskStatus OnUpdate() + { + if (specifiedCollider == null) { + Debug.LogWarning("SpecifiedCollider is null"); + return TaskStatus.Failure; + } + + specifiedCollider.Value.enabled = enabled.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + specifiedCollider.Value = null; + enabled = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Collider/SetEnabled.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Collider/SetEnabled.cs.meta new file mode 100644 index 000000000..8a15cb529 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Collider/SetEnabled.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b09a9f05408671b4fbdda3531c9fe9d8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Collider/SetEnabled.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug.meta new file mode 100644 index 000000000..fd66ec63d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d1140cef910ebcb4fa9817c4ec7fe2df +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/DrawLine.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/DrawLine.cs new file mode 100644 index 000000000..2889d1a22 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/DrawLine.cs @@ -0,0 +1,36 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityDebug +{ + [TaskCategory("Unity/Debug")] + [TaskDescription("Draws a debug line")] + public class DrawLine : Action + { + [Tooltip("The start position")] + public SharedVector3 start; + [Tooltip("The end position")] + public SharedVector3 end; + [Tooltip("The color")] + public SharedColor color = Color.white; + [Tooltip("Duration the line will be visible for in seconds.\nDefault: 0 means 1 frame.")] + public SharedFloat duration; + [Tooltip("Whether the line should show through world geometry.")] + public SharedBool depthTest = true; + + public override TaskStatus OnUpdate() + { + Debug.DrawLine(start.Value, end.Value, color.Value, duration.Value, depthTest.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + start = Vector3.zero; + end = Vector3.zero; + color = Color.white; + duration = 0f; + depthTest = true; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/DrawLine.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/DrawLine.cs.meta new file mode 100644 index 000000000..f7b8686b2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/DrawLine.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 66a533f4f027ab44bb35e498d761ce50 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/DrawLine.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/DrawRay.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/DrawRay.cs new file mode 100644 index 000000000..34d064e1e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/DrawRay.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityDebug +{ + [TaskCategory("Unity/Debug")] + [TaskDescription("Draws a debug ray")] + public class DrawRay : Action + { + [Tooltip("The position")] + public SharedVector3 start; + [Tooltip("The direction")] + public SharedVector3 direction; + [Tooltip("The color")] + public SharedColor color = Color.white; + + public override TaskStatus OnUpdate() + { + Debug.DrawRay(start.Value, direction.Value, color.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + start = Vector3.zero; + direction = Vector3.zero; + color = Color.white; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/DrawRay.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/DrawRay.cs.meta new file mode 100644 index 000000000..34f871024 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/DrawRay.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 786ac0c09ce982e43b444670fdfe4c74 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/DrawRay.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/LogFormat.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/LogFormat.cs new file mode 100644 index 000000000..3536d518e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/LogFormat.cs @@ -0,0 +1,76 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityDebug +{ + [TaskDescription("LogFormat is analgous to Debug.LogFormat().\n" + + "It takes format string, substitutes arguments supplied a '{0-4}' and returns success.\n" + + "Any fields or arguments not supplied are ignored." + + "It can be used for debugging.")] + [TaskIcon("{SkinColor}LogIcon.png")] + public class LogFormat : Action + { + [Tooltip("Text format with {0}, {1}, etc")] + public SharedString textFormat; + + [Tooltip("Is this text an error?")] + public SharedBool logError; + + public SharedVariable arg0; + public SharedVariable arg1; + public SharedVariable arg2; + public SharedVariable arg3; + + public override TaskStatus OnUpdate() + { + var paramsArray = buildParamsArray(); + // Log the text and return success + if (logError.Value) { + Debug.LogErrorFormat(textFormat.Value, paramsArray); + } else { + Debug.LogFormat(textFormat.Value, paramsArray); + } + return TaskStatus.Success; + } + + private object[] buildParamsArray() { + object[] paramsArray; + if (isValid(arg3)) { + paramsArray = new object[4]; + paramsArray[3] = arg3.GetValue(); + paramsArray[2] = arg2.GetValue(); + paramsArray[1] = arg1.GetValue(); + paramsArray[0] = arg0.GetValue(); + } else if (isValid(arg2)) { + paramsArray = new object[3]; + paramsArray[2] = arg2.GetValue(); + paramsArray[1] = arg1.GetValue(); + paramsArray[0] = arg0.GetValue(); + } else if (isValid(arg1)) { + paramsArray = new object[2]; + paramsArray[1] = arg1.GetValue(); + paramsArray[0] = arg0.GetValue(); + } else if (isValid(arg0)) { + paramsArray = new object[1]; + paramsArray[0] = arg0.GetValue(); + } else { + return null; + } + return paramsArray; + } + + private bool isValid(SharedVariable sv) { + return null != sv && !sv.IsNone; + } + + public override void OnReset() + { + // Reset the properties back to their original values + textFormat = string.Empty; + logError = false; + arg0 = null; + arg1 = null; + arg2 = null; + arg3 = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/LogFormat.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/LogFormat.cs.meta new file mode 100644 index 000000000..08dd51b1d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/LogFormat.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 70765819b419e8a45b326e92edf17ef5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/LogFormat.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/LogValue.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/LogValue.cs new file mode 100644 index 000000000..96b5057fa --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/LogValue.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityDebug +{ + [TaskCategory("Unity/Debug")] + [TaskDescription("Log a variable value.")] + public class LogValue : Action + { + [Tooltip("The variable to output")] + public SharedGenericVariable variable; + + public override TaskStatus OnUpdate() + { + Debug.Log(variable.Value.value.GetValue()); + + return TaskStatus.Success; + } + + public override void OnReset() + { + variable = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/LogValue.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/LogValue.cs.meta new file mode 100644 index 000000000..d3efac0ef --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/LogValue.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c50983a88995f4f4197f7b39ca796667 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Debug/LogValue.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject.meta new file mode 100644 index 000000000..c0d4b9409 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c03de85966f0a834383cef512841e4a9 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/ActiveInHierarchy.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/ActiveInHierarchy.cs new file mode 100644 index 000000000..ea41a2d40 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/ActiveInHierarchy.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject +{ + [TaskCategory("Unity/GameObject")] + [TaskDescription("Returns Success if the GameObject is active in the hierarchy, otherwise Failure.")] + public class ActiveInHierarchy : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + public override TaskStatus OnUpdate() + { + return GetDefaultGameObject(targetGameObject.Value).activeInHierarchy ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/ActiveInHierarchy.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/ActiveInHierarchy.cs.meta new file mode 100644 index 000000000..fc52832da --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/ActiveInHierarchy.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 0bbe57db7a21ee94f86aef75bbcd6d18 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/ActiveInHierarchy.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/ActiveSelf.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/ActiveSelf.cs new file mode 100644 index 000000000..71a644b5c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/ActiveSelf.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject +{ + [TaskCategory("Unity/GameObject")] + [TaskDescription("Returns Success if the GameObject is active in the hierarchy, otherwise Failure.")] + public class ActiveSelf : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + public override TaskStatus OnUpdate() + { + return GetDefaultGameObject(targetGameObject.Value).activeSelf ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/ActiveSelf.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/ActiveSelf.cs.meta new file mode 100644 index 000000000..28a3cab66 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/ActiveSelf.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 26a4530d0ecaa774aaf060511089ddc3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/ActiveSelf.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/CompareLayer.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/CompareLayer.cs new file mode 100644 index 000000000..c7da78d97 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/CompareLayer.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject +{ + [TaskCategory("Unity/GameObject")] + [TaskDescription("Returns Success if the layermasks match, otherwise Failure.")] + public class CompareLayerMask : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The layermask to compare against")] + public LayerMask layermask; + + public override TaskStatus OnUpdate() + { + return ((1 << GetDefaultGameObject(targetGameObject.Value).layer) & layermask.value) != 0 ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/CompareLayer.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/CompareLayer.cs.meta new file mode 100644 index 000000000..ffb8d3092 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/CompareLayer.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1458e688aa4cc8449bd37ebdcf7903d6 +timeCreated: 1503157605 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/CompareLayer.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/CompareTag.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/CompareTag.cs new file mode 100644 index 000000000..b91e094a9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/CompareTag.cs @@ -0,0 +1,25 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject +{ + [TaskCategory("Unity/GameObject")] + [TaskDescription("Returns Success if tags match, otherwise Failure.")] + public class CompareTag : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The tag to compare against")] + public SharedString tag; + + public override TaskStatus OnUpdate() + { + return GetDefaultGameObject(targetGameObject.Value).CompareTag(tag.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + tag = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/CompareTag.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/CompareTag.cs.meta new file mode 100644 index 000000000..89fdda878 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/CompareTag.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fa50c2eedc866794890ff361bdd1d593 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/CompareTag.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Destroy.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Destroy.cs new file mode 100644 index 000000000..b91d45bf0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Destroy.cs @@ -0,0 +1,32 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject +{ + [TaskCategory("Unity/GameObject")] + [TaskDescription("Destorys the specified GameObject. Returns Success.")] + public class Destroy : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Time to destroy the GameObject in")] + public float time; + + public override TaskStatus OnUpdate() + { + var destroyGameObject = GetDefaultGameObject(targetGameObject.Value); + if (time == 0) { + GameObject.Destroy(destroyGameObject); + } else { + GameObject.Destroy(destroyGameObject, time); + } + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + time = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Destroy.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Destroy.cs.meta new file mode 100644 index 000000000..d78520c10 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Destroy.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 42a90ad4cba90604b8be494aa74df349 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Destroy.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/DestroyImmediate.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/DestroyImmediate.cs new file mode 100644 index 000000000..600c07428 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/DestroyImmediate.cs @@ -0,0 +1,25 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject +{ + [TaskCategory("Unity/GameObject")] + [TaskDescription("Destorys the specified GameObject immediately. Returns Success.")] + public class DestroyImmediate : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + public override TaskStatus OnUpdate() + { + var destroyGameObject = GetDefaultGameObject(targetGameObject.Value); + GameObject.DestroyImmediate(destroyGameObject); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/DestroyImmediate.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/DestroyImmediate.cs.meta new file mode 100644 index 000000000..925da85a7 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/DestroyImmediate.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 81f8712bcbdbdbf4aad17ba5e1e20d8c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/DestroyImmediate.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Find.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Find.cs new file mode 100644 index 000000000..c7b1f6902 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Find.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject +{ + [TaskCategory("Unity/GameObject")] + [TaskDescription("Finds a GameObject by name. Returns success if an object is found.")] + public class Find : Action + { + [Tooltip("The GameObject name to find")] + public SharedString gameObjectName; + [Tooltip("The object found by name")] + [RequiredField] + public SharedGameObject storeValue; + + public override TaskStatus OnUpdate() + { + storeValue.Value = GameObject.Find(gameObjectName.Value); + + return storeValue.Value != null ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + gameObjectName = null; + storeValue = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Find.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Find.cs.meta new file mode 100644 index 000000000..3b3038197 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Find.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5388c9a6fc7770f44885176c24f68aaa +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Find.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/FindGameObjectsWithTag.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/FindGameObjectsWithTag.cs new file mode 100644 index 000000000..9af0c77e0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/FindGameObjectsWithTag.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject +{ + [TaskCategory("Unity/GameObject")] + [TaskDescription("Finds a GameObject by tag. Returns Success.")] + public class FindGameObjectsWithTag : Action + { + [Tooltip("The tag of the GameObject to find")] + public SharedString tag; + [Tooltip("The objects found by name")] + [RequiredField] + public SharedGameObjectList storeValue; + + public override TaskStatus OnUpdate() + { + var gameObjects = GameObject.FindGameObjectsWithTag(tag.Value); + for (int i = 0; i < gameObjects.Length; ++i) { + storeValue.Value.Add(gameObjects[i]); + } + + return TaskStatus.Success; + } + + public override void OnReset() + { + tag.Value = null; + storeValue.Value = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/FindGameObjectsWithTag.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/FindGameObjectsWithTag.cs.meta new file mode 100644 index 000000000..170747ff4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/FindGameObjectsWithTag.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ccc3e1d2bf7cfc74089c17d593472f98 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/FindGameObjectsWithTag.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/FindWithTag.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/FindWithTag.cs new file mode 100644 index 000000000..4730ebe24 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/FindWithTag.cs @@ -0,0 +1,36 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject +{ + [TaskCategory("Unity/GameObject")] + [TaskDescription("Finds a GameObject by tag. Returns success if an object is found.")] + public class FindWithTag : Action + { + [Tooltip("The tag of the GameObject to find")] + public SharedString tag; + [Tooltip("Should a random GameObject be found?")] + public SharedBool random; + [Tooltip("The object found by name")] + [RequiredField] + public SharedGameObject storeValue; + + public override TaskStatus OnUpdate() + { + if (random.Value) { + var gameObjects = GameObject.FindGameObjectsWithTag(tag.Value); + if (gameObjects == null || gameObjects.Length == 0) { return TaskStatus.Failure; } + storeValue.Value = gameObjects[Random.Range(0, gameObjects.Length)]; + } else { + storeValue.Value = GameObject.FindWithTag(tag.Value); + } + + return storeValue.Value != null ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + tag.Value = null; + storeValue.Value = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/FindWithTag.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/FindWithTag.cs.meta new file mode 100644 index 000000000..3f5f99d1b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/FindWithTag.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d8768bdf841982f4aae662ee5dac3f2d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/FindWithTag.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/GetComponent.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/GetComponent.cs new file mode 100644 index 000000000..387f3abd3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/GetComponent.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject +{ + [TaskCategory("Unity/GameObject")] + [TaskDescription("Returns the component of Type type if the game object has one attached, null if it doesn't. Returns Success.")] + public class GetComponent : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The type of component")] + public SharedString type; + [Tooltip("The component")] + [RequiredField] + public SharedObject storeValue; + + public override TaskStatus OnUpdate() + { + storeValue.Value = GetDefaultGameObject(targetGameObject.Value).GetComponent(type.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + type.Value = ""; + storeValue.Value = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/GetComponent.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/GetComponent.cs.meta new file mode 100644 index 000000000..e3173a482 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/GetComponent.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 46e3dd9b1b260584b893abde5f733359 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/GetComponent.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/GetTag.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/GetTag.cs new file mode 100644 index 000000000..2d271a3e0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/GetTag.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject +{ + [TaskCategory("Unity/GameObject")] + [TaskDescription("Stores the GameObject tag. Returns Success.")] + public class GetTag : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Active state of the GameObject")] + [RequiredField] + public SharedString storeValue; + + public override TaskStatus OnUpdate() + { + storeValue.Value = GetDefaultGameObject(targetGameObject.Value).tag; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/GetTag.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/GetTag.cs.meta new file mode 100644 index 000000000..e09699129 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/GetTag.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 44bf3273a8802dc408352f165f18c541 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/GetTag.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Instantiate.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Instantiate.cs new file mode 100644 index 000000000..c1929e274 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Instantiate.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject +{ + [TaskCategory("Unity/GameObject")] + [TaskDescription("Instantiates a new GameObject. Returns Success.")] + public class Instantiate : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The position of the new GameObject")] + public SharedVector3 position; + [Tooltip("The rotation of the new GameObject")] + public SharedQuaternion rotation = Quaternion.identity; + [SharedRequired] + [Tooltip("The instantiated GameObject")] + public SharedGameObject storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = GameObject.Instantiate(targetGameObject.Value, position.Value, rotation.Value) as GameObject; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + position = Vector3.zero; + rotation = Quaternion.identity; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Instantiate.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Instantiate.cs.meta new file mode 100644 index 000000000..bb64a0399 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Instantiate.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 804a64515d87a0546ad7c6c4408ed53f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/Instantiate.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SendMessage.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SendMessage.cs new file mode 100644 index 000000000..354fa41b8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SendMessage.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject +{ + [TaskCategory("Unity/GameObject")] + [TaskDescription("Sends a message to the target GameObject. Returns Success.")] + public class SendMessage : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The message to send")] + public SharedString message; + [Tooltip("The value to send")] + public SharedGenericVariable value; + + public override TaskStatus OnUpdate() + { + if (value.Value != null) { + GetDefaultGameObject(targetGameObject.Value).SendMessage(message.Value, value.Value.value.GetValue()); + } else { + GetDefaultGameObject(targetGameObject.Value).SendMessage(message.Value); + } + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + message = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SendMessage.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SendMessage.cs.meta new file mode 100644 index 000000000..2e47b2b1a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SendMessage.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: dd0f144b1db34024eaea548f6539d2ae +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SendMessage.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SetActive.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SetActive.cs new file mode 100644 index 000000000..f790089ab --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SetActive.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject +{ + [TaskCategory("Unity/GameObject")] + [TaskDescription("Activates/Deactivates the GameObject. Returns Success.")] + public class SetActive : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Active state of the GameObject")] + public SharedBool active; + + public override TaskStatus OnUpdate() + { + GetDefaultGameObject(targetGameObject.Value).SetActive(active.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + active = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SetActive.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SetActive.cs.meta new file mode 100644 index 000000000..017f94f78 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SetActive.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5237a810dcce11e499c1915171ec670b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SetActive.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SetTag.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SetTag.cs new file mode 100644 index 000000000..283360b27 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SetTag.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject +{ + [TaskCategory("Unity/GameObject")] + [TaskDescription("Sets the GameObject tag. Returns Success.")] + public class SetTag : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The GameObject tag")] + public SharedString tag; + + public override TaskStatus OnUpdate() + { + GetDefaultGameObject(targetGameObject.Value).tag = tag.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + tag = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SetTag.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SetTag.cs.meta new file mode 100644 index 000000000..53d136361 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SetTag.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e275477e6962d9b4fb90d7930bb6ff5a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/GameObject/SetTag.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input.meta new file mode 100644 index 000000000..56aea24fb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 77642b8113f3f334d971d61be9516264 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAcceleration.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAcceleration.cs new file mode 100644 index 000000000..d1a9f3728 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAcceleration.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityInput +{ + [TaskCategory("Unity/Input")] + [TaskDescription("Stores the acceleration value.")] + public class GetAcceleration : Action + { + [RequiredField] + [Tooltip("The stored result")] + public SharedVector3 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Input.acceleration; + return TaskStatus.Success; + } + + public override void OnReset() + { + storeResult = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAcceleration.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAcceleration.cs.meta new file mode 100644 index 000000000..f156415ff --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAcceleration.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 06e82895d2abea24599ddfd6f0d7386a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAcceleration.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAxis.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAxis.cs new file mode 100644 index 000000000..6338f95b0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAxis.cs @@ -0,0 +1,37 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityInput +{ + [TaskCategory("Unity/Input")] + [TaskDescription("Stores the value of the specified axis and stores it in a float.")] + public class GetAxis : Action + { + [Tooltip("The name of the axis")] + public SharedString axisName; + [Tooltip("Axis values are in the range -1 to 1. Use the multiplier to set a larger range")] + public SharedFloat multiplier; + [RequiredField] + [Tooltip("The stored result")] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + var axisValue = Input.GetAxis(axisName.Value); + + // if variable set to none, assume multiplier of 1 + if (!multiplier.IsNone) { + axisValue *= multiplier.Value; + } + + storeResult.Value = axisValue; + return TaskStatus.Success; + } + + public override void OnReset() + { + axisName = ""; + multiplier = 1.0f; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAxis.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAxis.cs.meta new file mode 100644 index 000000000..c16b30719 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAxis.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 84fa68d3aa9286f488ee60bb7f420079 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAxis.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAxisRaw.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAxisRaw.cs new file mode 100644 index 000000000..8bf1bb073 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAxisRaw.cs @@ -0,0 +1,37 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityInput +{ + [TaskCategory("Unity/Input")] + [TaskDescription("Stores the raw value of the specified axis and stores it in a float.")] + public class GetAxisRaw : Action + { + [Tooltip("The name of the axis")] + public SharedString axisName; + [Tooltip("Axis values are in the range -1 to 1. Use the multiplier to set a larger range")] + public SharedFloat multiplier; + [RequiredField] + [Tooltip("The stored result")] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + var axisValue = Input.GetAxis(axisName.Value); + + // if variable set to none, assume multiplier of 1 + if (!multiplier.IsNone) { + axisValue *= multiplier.Value; + } + + storeResult.Value = axisValue; + return TaskStatus.Success; + } + + public override void OnReset() + { + axisName = ""; + multiplier = 1.0f; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAxisRaw.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAxisRaw.cs.meta new file mode 100644 index 000000000..cd7a90037 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAxisRaw.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d7ba1768defe9ae4489e2d849801caf2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetAxisRaw.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetButton.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetButton.cs new file mode 100644 index 000000000..e52bd22a9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetButton.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityInput +{ + [TaskCategory("Unity/Input")] + [TaskDescription("Stores the state of the specified button.")] + public class GetButton : Action + { + [Tooltip("The name of the button")] + public SharedString buttonName; + [RequiredField] + [Tooltip("The stored result")] + public SharedBool storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Input.GetButton(buttonName.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + buttonName = "Fire1"; + storeResult = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetButton.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetButton.cs.meta new file mode 100644 index 000000000..368bc453f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetButton.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7ca2e1ded24b0a144b628bb8ed81ccd0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetButton.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetKey.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetKey.cs new file mode 100644 index 000000000..bb356ccb7 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetKey.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityInput +{ + [TaskCategory("Unity/Input")] + [TaskDescription("Stores the pressed state of the specified key.")] + public class GetKey : Action + { + [Tooltip("The key to test.")] + public KeyCode key; + [RequiredField] + [Tooltip("The stored result")] + public SharedBool storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Input.GetKey(key); + return TaskStatus.Success; + } + + public override void OnReset() + { + key = KeyCode.None; + storeResult = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetKey.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetKey.cs.meta new file mode 100644 index 000000000..8f31344ef --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetKey.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8d91595c5c003b948abb908c7465a7ec +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetKey.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetMouseButton.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetMouseButton.cs new file mode 100644 index 000000000..94595b9f4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetMouseButton.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityInput +{ + [TaskCategory("Unity/Input")] + [TaskDescription("Stores the state of the specified mouse button.")] + public class GetMouseButton : Action + { + [Tooltip("The index of the button")] + public SharedInt buttonIndex; + [RequiredField] + [Tooltip("The stored result")] + public SharedBool storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Input.GetMouseButton(buttonIndex.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + buttonIndex = 0; + storeResult = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetMouseButton.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetMouseButton.cs.meta new file mode 100644 index 000000000..32d3a7e4f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetMouseButton.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3449e6301a95d9e49a8f6b50ef862faa +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetMouseButton.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetMousePosition.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetMousePosition.cs new file mode 100644 index 000000000..d71d31e1a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetMousePosition.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityInput +{ + [TaskCategory("Unity/Input")] + [TaskDescription("Stores the mouse position.")] + public class GetMousePosition : Action + { + [RequiredField] + [Tooltip("The stored result")] + public SharedVector3 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Input.mousePosition; + return TaskStatus.Success; + } + + public override void OnReset() + { + storeResult = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetMousePosition.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetMousePosition.cs.meta new file mode 100644 index 000000000..43430e152 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetMousePosition.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f11dbb85cfc5b3941ae4f82fa54b7d27 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Input/GetMousePosition.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsButtonDown.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsButtonDown.cs new file mode 100644 index 000000000..26d7d9814 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsButtonDown.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityInput +{ + [TaskCategory("Unity/Input")] + [TaskDescription("Returns success when the specified button is pressed.")] + public class IsButtonDown : Conditional + { + [Tooltip("The name of the button")] + public SharedString buttonName; + + public override TaskStatus OnUpdate() + { + return Input.GetButtonDown(buttonName.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + buttonName = "Fire1"; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsButtonDown.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsButtonDown.cs.meta new file mode 100644 index 000000000..9692b3799 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsButtonDown.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 554c281a83ae5bb4bbcdf3bdeac6779e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsButtonDown.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsButtonUp.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsButtonUp.cs new file mode 100644 index 000000000..d3dafa495 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsButtonUp.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityInput +{ + [TaskCategory("Unity/Input")] + [TaskDescription("Returns success when the specified button is released.")] + public class IsButtonUp : Conditional + { + [Tooltip("The name of the button")] + public SharedString buttonName; + + public override TaskStatus OnUpdate() + { + return Input.GetButtonUp(buttonName.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + buttonName = "Fire1"; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsButtonUp.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsButtonUp.cs.meta new file mode 100644 index 000000000..d1e34b2cc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsButtonUp.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 71d9dda886873b943922eae52da81244 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsButtonUp.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsKeyDown.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsKeyDown.cs new file mode 100644 index 000000000..51259664a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsKeyDown.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityInput +{ + [TaskCategory("Unity/Input")] + [TaskDescription("Returns success when the specified key is pressed.")] + public class IsKeyDown : Conditional + { + [Tooltip("The key to test")] + public KeyCode key; + + public override TaskStatus OnUpdate() + { + return Input.GetKeyDown(key) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + key = KeyCode.None; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsKeyDown.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsKeyDown.cs.meta new file mode 100644 index 000000000..3e66ca81a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsKeyDown.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b4c02f1f071b9604389e1c1f1bfab3eb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsKeyDown.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsKeyUp.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsKeyUp.cs new file mode 100644 index 000000000..889b54d57 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsKeyUp.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityInput +{ + [TaskCategory("Unity/Input")] + [TaskDescription("Returns success when the specified key is released.")] + public class IsKeyUp : Conditional + { + [Tooltip("The key to test")] + public KeyCode key; + + public override TaskStatus OnUpdate() + { + return Input.GetKeyUp(key) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + key = KeyCode.None; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsKeyUp.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsKeyUp.cs.meta new file mode 100644 index 000000000..9a0dc1789 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsKeyUp.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7d8622d5540c851448ad036016f0f426 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsKeyUp.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsMouseDown.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsMouseDown.cs new file mode 100644 index 000000000..a095c99b1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsMouseDown.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityInput +{ + [TaskCategory("Unity/Input")] + [TaskDescription("Returns success when the specified mouse button is pressed.")] + public class IsMouseDown : Conditional + { + [Tooltip("The button index")] + public SharedInt buttonIndex; + + public override TaskStatus OnUpdate() + { + return Input.GetMouseButtonDown(buttonIndex.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + buttonIndex = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsMouseDown.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsMouseDown.cs.meta new file mode 100644 index 000000000..01e330d64 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsMouseDown.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fd85264410cd9ac45b0c9c2e550f7c46 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsMouseDown.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsMouseUp.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsMouseUp.cs new file mode 100644 index 000000000..4da08613c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsMouseUp.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityInput +{ + [TaskCategory("Unity/Input")] + [TaskDescription("Returns success when the specified mouse button is pressed.")] + public class IsMouseUp : Conditional + { + [Tooltip("The button index")] + public SharedInt buttonIndex; + + public override TaskStatus OnUpdate() + { + return Input.GetMouseButtonUp(buttonIndex.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + buttonIndex = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsMouseUp.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsMouseUp.cs.meta new file mode 100644 index 000000000..7ba345968 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsMouseUp.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b2ecc8718d19d9b46832c51de0390245 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Input/IsMouseUp.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask.meta new file mode 100644 index 000000000..acfd7dc0b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 03592e079804666408280a195c972a69 +folderAsset: yes +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask/GetLayer.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask/GetLayer.cs new file mode 100644 index 000000000..a5d0238e8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask/GetLayer.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLayerMask +{ + [TaskCategory("Unity/LayerMask")] + [TaskDescription("Gets the layer of a GameObject.")] + public class GetLayer : Action + { + [Tooltip("The GameObject to set the layer of")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the layer to get")] + [RequiredField] + public SharedString storeResult; + + public override TaskStatus OnUpdate() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + storeResult.Value = LayerMask.LayerToName(currentGameObject.layer); + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask/GetLayer.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask/GetLayer.cs.meta new file mode 100644 index 000000000..daafdb1fb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask/GetLayer.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4a7e0974f9cfb9945bb2d0f41ed55f10 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask/GetLayer.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask/SetLayer.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask/SetLayer.cs new file mode 100644 index 000000000..1e85c6797 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask/SetLayer.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLayerMask +{ + [TaskCategory("Unity/LayerMask")] + [TaskDescription("Sets the layer of a GameObject.")] + public class SetLayer : Action + { + [Tooltip("The GameObject to set the layer of")] + public SharedGameObject targetGameObject; + [Tooltip("The name of the layer to set")] + public SharedString layerName = "Default"; + + public override TaskStatus OnUpdate() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + currentGameObject.layer = LayerMask.NameToLayer(layerName.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + layerName = "Default"; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask/SetLayer.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask/SetLayer.cs.meta new file mode 100644 index 000000000..0452c3987 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask/SetLayer.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 483904cd6081c8440a146b11481d6623 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/LayerMask/SetLayer.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light.meta new file mode 100644 index 000000000..55d3e0b2e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 48823f7ab681c2b4f9439c617555cf7a +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetColor.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetColor.cs new file mode 100644 index 000000000..b6971a12f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetColor.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Stores the color of the light.")] + public class GetColor : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [RequiredField] + [Tooltip("The color to store")] + public SharedColor storeValue; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + storeValue = light.color; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Color.white; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetColor.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetColor.cs.meta new file mode 100644 index 000000000..7a7ef7567 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetColor.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 935c3e08c991a524fa451ba010bb7077 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetColor.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetCookieSize.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetCookieSize.cs new file mode 100644 index 000000000..4c1965049 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetCookieSize.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Stores the light's cookie size.")] + public class GetCookieSize : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [RequiredField] + [Tooltip("The size to store")] + public SharedFloat storeValue; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + storeValue = light.cookieSize; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetCookieSize.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetCookieSize.cs.meta new file mode 100644 index 000000000..0f6f565df --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetCookieSize.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4c382d40893d45d46842714355d4cab4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetCookieSize.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetIntensity.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetIntensity.cs new file mode 100644 index 000000000..e8c6b355c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetIntensity.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Stores the intensity of the light.")] + public class GetIntensity : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [RequiredField] + [Tooltip("The intensity to store")] + public SharedFloat storeValue; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + storeValue.Value = light.intensity; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetIntensity.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetIntensity.cs.meta new file mode 100644 index 000000000..bdb7286c2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetIntensity.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8af031ee741aec645bcf65ae806e78a7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetIntensity.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetRange.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetRange.cs new file mode 100644 index 000000000..d735777e9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetRange.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Stores the range of the light.")] + public class GetRange : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [RequiredField] + [Tooltip("The range to store")] + public SharedFloat storeValue; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + storeValue = light.range; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetRange.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetRange.cs.meta new file mode 100644 index 000000000..1ad1504dc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetRange.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5ebab1924e0212c4ca589526a033fda6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetRange.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetShadowBias.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetShadowBias.cs new file mode 100644 index 000000000..55be16a7a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetShadowBias.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Stores the shadow bias of the light.")] + public class GetShadowBias : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [RequiredField] + [Tooltip("The shadow bias to store")] + public SharedFloat storeValue; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + storeValue = light.shadowBias; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetShadowBias.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetShadowBias.cs.meta new file mode 100644 index 000000000..d2ddb4336 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetShadowBias.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9d0cbb27de892b44193aaa9f12842ed2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetShadowBias.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetShadowStrength.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetShadowStrength.cs new file mode 100644 index 000000000..a5b49c482 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetShadowStrength.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Stores the color of the light.")] + public class GetShadowStrength : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [RequiredField] + [Tooltip("The color to store")] + public SharedFloat storeValue; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + storeValue = light.shadowStrength; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetShadowStrength.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetShadowStrength.cs.meta new file mode 100644 index 000000000..8c52ca0e2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetShadowStrength.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7a7fe83e412ff344888939e6a974a064 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetShadowStrength.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetSpotAngle.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetSpotAngle.cs new file mode 100644 index 000000000..e17266097 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetSpotAngle.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Stores the spot angle of the light.")] + public class GetSpotAngle : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [RequiredField] + [Tooltip("The spot angle to store")] + public SharedFloat storeValue; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + storeValue = light.spotAngle; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetSpotAngle.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetSpotAngle.cs.meta new file mode 100644 index 000000000..76dd5f3bb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetSpotAngle.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4dfc8df823e06cd45a09d929a060f99d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/GetSpotAngle.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetColor.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetColor.cs new file mode 100644 index 000000000..aeed40a09 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetColor.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Sets the color of the light.")] + public class SetColor : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The color to set")] + public SharedColor color; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + light.color = color.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + color = Color.white; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetColor.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetColor.cs.meta new file mode 100644 index 000000000..df87f2372 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetColor.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 0ba683b0b18385042b3351c660f29d33 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetColor.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCookie.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCookie.cs new file mode 100644 index 000000000..785502be7 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCookie.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Sets the cookie of the light.")] + public class SetCookie : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The cookie to set")] + public Texture2D cookie; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + light.cookie = cookie; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + cookie = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCookie.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCookie.cs.meta new file mode 100644 index 000000000..10ff388bc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCookie.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 374f9a87dc387a04585b87f187d019c5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCookie.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCookieSize.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCookieSize.cs new file mode 100644 index 000000000..aeda25f63 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCookieSize.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Sets the light's cookie size.")] + public class SetCookieSize : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The size to set")] + public SharedFloat cookieSize; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + light.cookieSize = cookieSize.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + cookieSize = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCookieSize.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCookieSize.cs.meta new file mode 100644 index 000000000..a64339deb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCookieSize.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fbc2d3865f928144ea551b1d927ddc96 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCookieSize.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCullingMask.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCullingMask.cs new file mode 100644 index 000000000..6ecf52375 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCullingMask.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Sets the culling mask of the light.")] + public class SetCullingMask : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The culling mask to set")] + public LayerMask cullingMask; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + light.cullingMask = cullingMask.value; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + cullingMask = -1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCullingMask.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCullingMask.cs.meta new file mode 100644 index 000000000..e1deb8864 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCullingMask.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3f67673818b7e914ebf088b3752d716b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetCullingMask.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetIntensity.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetIntensity.cs new file mode 100644 index 000000000..d44c57318 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetIntensity.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Sets the intensity of the light.")] + public class SetIntensity : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The intensity to set")] + public SharedFloat intensity; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + light.intensity = intensity.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + intensity = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetIntensity.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetIntensity.cs.meta new file mode 100644 index 000000000..a1c247b9a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetIntensity.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1f32aa9b9681f0a4285bd60ac0607d00 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetIntensity.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetRange.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetRange.cs new file mode 100644 index 000000000..9866a174f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetRange.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Sets the range of the light.")] + public class SetRange : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The range to set")] + public SharedFloat range; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + light.range = range.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + range = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetRange.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetRange.cs.meta new file mode 100644 index 000000000..7931ee252 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetRange.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f0b5d0c0a07806244a3c5b15e29cf90c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetRange.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadowBias.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadowBias.cs new file mode 100644 index 000000000..1ea35ab33 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadowBias.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Sets the shadow bias of the light.")] + public class SetShadowBias : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The shadow bias to set")] + public SharedFloat shadowBias; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + light.shadowBias = shadowBias.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + shadowBias = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadowBias.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadowBias.cs.meta new file mode 100644 index 000000000..8ba787ad2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadowBias.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f2b374e3c2e26e94ba76dd68290ff538 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadowBias.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadowStrength.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadowStrength.cs new file mode 100644 index 000000000..486f31cbd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadowStrength.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Sets the shadow strength of the light.")] + public class SetShadowSoftnessStrength : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The shadow strength to set")] + public SharedFloat shadowStrength; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + light.shadowStrength = shadowStrength.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + shadowStrength = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadowStrength.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadowStrength.cs.meta new file mode 100644 index 000000000..fc9e38736 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadowStrength.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 611e5846c0413be46bbc44fbd256b4e9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadowStrength.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadows.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadows.cs new file mode 100644 index 000000000..dabe75264 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadows.cs @@ -0,0 +1,43 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Sets the shadow type of the light.")] + public class SetShadows : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The shadow type to set")] + public LightShadows shadows; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + light.shadows = shadows; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadows.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadows.cs.meta new file mode 100644 index 000000000..a4eb60944 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadows.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b6226eb03ad729445bc7ccfb1f0cd89d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetShadows.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetSpotAngle.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetSpotAngle.cs new file mode 100644 index 000000000..28b3ff688 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetSpotAngle.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Sets the spot angle of the light.")] + public class SetSpotAngle : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The spot angle to set")] + public SharedFloat spotAngle; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + light.spotAngle = spotAngle.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + spotAngle = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetSpotAngle.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetSpotAngle.cs.meta new file mode 100644 index 000000000..f243f4118 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetSpotAngle.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9a8b9b0654618fe48953e059d4aa5ee3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetSpotAngle.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetType.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetType.cs new file mode 100644 index 000000000..f4706a8ff --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetType.cs @@ -0,0 +1,43 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityLight +{ + [TaskCategory("Unity/Light")] + [TaskDescription("Sets the type of the light.")] + public class SetType : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The type to set")] + public LightType type; + + // cache the light component + private Light light; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + light = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (light == null) { + Debug.LogWarning("Light is null"); + return TaskStatus.Failure; + } + + light.type = type; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetType.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetType.cs.meta new file mode 100644 index 000000000..f008b67ff --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetType.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 85cae5f82bfcbfb41ac7c66464eef85f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Light/SetType.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math.meta new file mode 100644 index 000000000..862668e71 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: fffa44303fdbffe4289373d6e5087b4a +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolComparison.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolComparison.cs new file mode 100644 index 000000000..e176fa77d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolComparison.cs @@ -0,0 +1,23 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Performs a comparison between two bools.")] + public class BoolComparison : Conditional + { + [Tooltip("The first bool")] + public SharedBool bool1; + [Tooltip("The second bool")] + public SharedBool bool2; + + public override TaskStatus OnUpdate() + { + return bool1.Value == bool2.Value ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + bool1 = false; + bool2 = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolComparison.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolComparison.cs.meta new file mode 100644 index 000000000..2a850051b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolComparison.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: abaa3d78e68f249428f3be7acae86b0d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolComparison.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolFlip.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolFlip.cs new file mode 100644 index 000000000..351e31530 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolFlip.cs @@ -0,0 +1,21 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Flips the value of the bool.")] + public class BoolFlip : Action + { + [Tooltip("The bool to flip the value of")] + public SharedBool boolVariable; + + public override TaskStatus OnUpdate() + { + boolVariable.Value = !boolVariable.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + boolVariable.Value = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolFlip.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolFlip.cs.meta new file mode 100644 index 000000000..e1a1c3a90 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolFlip.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 54aae1e47fe3be6458751bf1f9defe8f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolFlip.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolOperator.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolOperator.cs new file mode 100644 index 000000000..7311642c5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolOperator.cs @@ -0,0 +1,50 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Performs a math operation on two bools: AND, OR, NAND, or XOR.")] + public class BoolOperator : Action + { + public enum Operation + { + AND, + OR, + NAND, + XOR + } + + [Tooltip("The operation to perform")] + public Operation operation; + [Tooltip("The first bool")] + public SharedBool bool1; + [Tooltip("The second bool")] + public SharedBool bool2; + [Tooltip("The variable to store the result")] + public SharedBool storeResult; + + public override TaskStatus OnUpdate() + { + switch (operation) { + case Operation.AND: + storeResult.Value = bool1.Value && bool2.Value; + break; + case Operation.OR: + storeResult.Value = bool1.Value || bool2.Value; + break; + case Operation.NAND: + storeResult.Value = !(bool1.Value && bool2.Value); + break; + case Operation.XOR: + storeResult.Value = bool1.Value ^ bool2.Value; + break; + } + return TaskStatus.Success; + } + + public override void OnReset() + { + operation = Operation.AND; + bool1 = false; + bool2 = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolOperator.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolOperator.cs.meta new file mode 100644 index 000000000..d76837595 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolOperator.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: bd7b9dfddd114be4a8c8a8521262970d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/BoolOperator.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatAbs.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatAbs.cs new file mode 100644 index 000000000..b5be228d2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatAbs.cs @@ -0,0 +1,23 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Stores the absolute value of the float.")] + public class FloatAbs : Action + { + [Tooltip("The float to return the absolute value of")] + public SharedFloat floatVariable; + + public override TaskStatus OnUpdate() + { + floatVariable.Value = Mathf.Abs(floatVariable.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + floatVariable = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatAbs.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatAbs.cs.meta new file mode 100644 index 000000000..87b9f7c2a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatAbs.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ab5531c4ed335b643a6f310c048a6b00 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatAbs.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatClamp.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatClamp.cs new file mode 100644 index 000000000..667b09766 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatClamp.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Clamps the float between two values.")] + public class FloatClamp : Action + { + [Tooltip("The float to clamp")] + public SharedFloat floatVariable; + [Tooltip("The maximum value of the float")] + public SharedFloat minValue; + [Tooltip("The maximum value of the float")] + public SharedFloat maxValue; + + public override TaskStatus OnUpdate() + { + floatVariable.Value = Mathf.Clamp(floatVariable.Value, minValue.Value, maxValue.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + floatVariable = 0; + minValue = 0; + maxValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatClamp.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatClamp.cs.meta new file mode 100644 index 000000000..0b05c7d8a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatClamp.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 75c3634f2c8f1dd49b826a7ac0c7bdbe +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatClamp.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatComparison.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatComparison.cs new file mode 100644 index 000000000..a1d238224 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatComparison.cs @@ -0,0 +1,50 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Performs comparison between two floats: less than, less than or equal to, equal to, not equal to, greater than or equal to, or greater than.")] + public class FloatComparison : Conditional + { + public enum Operation + { + LessThan, + LessThanOrEqualTo, + EqualTo, + NotEqualTo, + GreaterThanOrEqualTo, + GreaterThan + } + + [Tooltip("The operation to perform")] + public Operation operation; + [Tooltip("The first float")] + public SharedFloat float1; + [Tooltip("The second float")] + public SharedFloat float2; + + public override TaskStatus OnUpdate() + { + switch (operation) { + case Operation.LessThan: + return float1.Value < float2.Value ? TaskStatus.Success : TaskStatus.Failure; + case Operation.LessThanOrEqualTo: + return float1.Value <= float2.Value ? TaskStatus.Success : TaskStatus.Failure; + case Operation.EqualTo: + return UnityEngine.Mathf.Approximately(float1.Value, float2.Value) ? TaskStatus.Success : TaskStatus.Failure; + case Operation.NotEqualTo: + return !UnityEngine.Mathf.Approximately(float1.Value, float2.Value) ? TaskStatus.Success : TaskStatus.Failure; + case Operation.GreaterThanOrEqualTo: + return float1.Value >= float2.Value ? TaskStatus.Success : TaskStatus.Failure; + case Operation.GreaterThan: + return float1.Value > float2.Value ? TaskStatus.Success : TaskStatus.Failure; + } + return TaskStatus.Failure; + } + + public override void OnReset() + { + operation = Operation.LessThan; + float1.Value = 0; + float2.Value = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatComparison.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatComparison.cs.meta new file mode 100644 index 000000000..623061f7d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatComparison.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 79c81f4e67dbdc44880734e78153117c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatComparison.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatOperator.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatOperator.cs new file mode 100644 index 000000000..d222db4ec --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatOperator.cs @@ -0,0 +1,65 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Performs a math operation on two floats: Add, Subtract, Multiply, Divide, Min, or Max.")] + public class FloatOperator : Action + { + public enum Operation + { + Add, + Subtract, + Multiply, + Divide, + Min, + Max, + Modulo + } + + [Tooltip("The operation to perform")] + public Operation operation; + [Tooltip("The first float")] + public SharedFloat float1; + [Tooltip("The second float")] + public SharedFloat float2; + [Tooltip("The variable to store the result")] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + switch (operation) { + case Operation.Add: + storeResult.Value = float1.Value + float2.Value; + break; + case Operation.Subtract: + storeResult.Value = float1.Value - float2.Value; + break; + case Operation.Multiply: + storeResult.Value = float1.Value * float2.Value; + break; + case Operation.Divide: + storeResult.Value = float1.Value / float2.Value; + break; + case Operation.Min: + storeResult.Value = Mathf.Min(float1.Value, float2.Value); + break; + case Operation.Max: + storeResult.Value = Mathf.Max(float1.Value, float2.Value); + break; + case Operation.Modulo: + storeResult.Value = float1.Value % float2.Value; + break; + } + return TaskStatus.Success; + } + + public override void OnReset() + { + operation = Operation.Add; + float1 = 0; + float2 = 0; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatOperator.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatOperator.cs.meta new file mode 100644 index 000000000..d8ffb0d8c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatOperator.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9144ac2a8b796c941aeb3d6a4bc2cf7c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/FloatOperator.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntAbs.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntAbs.cs new file mode 100644 index 000000000..d2ae96a41 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntAbs.cs @@ -0,0 +1,23 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Stores the absolute value of the int.")] + public class IntAbs : Action + { + [Tooltip("The int to return the absolute value of")] + public SharedInt intVariable; + + public override TaskStatus OnUpdate() + { + intVariable.Value = Mathf.Abs(intVariable.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + intVariable = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntAbs.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntAbs.cs.meta new file mode 100644 index 000000000..58cdab971 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntAbs.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8edcbab77068fe044842381cfe0acc19 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntAbs.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntClamp.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntClamp.cs new file mode 100644 index 000000000..f26a11041 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntClamp.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Clamps the int between two values.")] + public class IntClamp : Action + { + [Tooltip("The int to clamp")] + public SharedInt intVariable; + [Tooltip("The maximum value of the int")] + public SharedInt minValue; + [Tooltip("The maximum value of the int")] + public SharedInt maxValue; + + public override TaskStatus OnUpdate() + { + intVariable.Value = Mathf.Clamp(intVariable.Value, minValue.Value, maxValue.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + intVariable = 0; + minValue = 0; + maxValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntClamp.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntClamp.cs.meta new file mode 100644 index 000000000..9875c538a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntClamp.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 67cbe30015f2b4940a069cbbee22d888 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntClamp.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntComparison.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntComparison.cs new file mode 100644 index 000000000..24d55a93e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntComparison.cs @@ -0,0 +1,50 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Performs comparison between two integers: less than, less than or equal to, equal to, not equal to, greater than or equal to, or greater than.")] + public class IntComparison : Conditional + { + public enum Operation + { + LessThan, + LessThanOrEqualTo, + EqualTo, + NotEqualTo, + GreaterThanOrEqualTo, + GreaterThan + } + + [Tooltip("The operation to perform")] + public Operation operation; + [Tooltip("The first integer")] + public SharedInt integer1; + [Tooltip("The second integer")] + public SharedInt integer2; + + public override TaskStatus OnUpdate() + { + switch (operation) { + case Operation.LessThan: + return integer1.Value < integer2.Value ? TaskStatus.Success : TaskStatus.Failure; + case Operation.LessThanOrEqualTo: + return integer1.Value <= integer2.Value ? TaskStatus.Success : TaskStatus.Failure; + case Operation.EqualTo: + return integer1.Value == integer2.Value ? TaskStatus.Success : TaskStatus.Failure; + case Operation.NotEqualTo: + return integer1.Value != integer2.Value ? TaskStatus.Success : TaskStatus.Failure; + case Operation.GreaterThanOrEqualTo: + return integer1.Value >= integer2.Value ? TaskStatus.Success : TaskStatus.Failure; + case Operation.GreaterThan: + return integer1.Value > integer2.Value ? TaskStatus.Success : TaskStatus.Failure; + } + return TaskStatus.Failure; + } + + public override void OnReset() + { + operation = Operation.LessThan; + integer1.Value = 0; + integer2.Value = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntComparison.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntComparison.cs.meta new file mode 100644 index 000000000..74ce09d15 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntComparison.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 99108c35b6d8e9942b8cf441a63f97b5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntComparison.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntOperator.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntOperator.cs new file mode 100644 index 000000000..f104ebbc1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntOperator.cs @@ -0,0 +1,66 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Performs a math operation on two integers: Add, Subtract, Multiply, Divide, Min, or Max.")] + public class IntOperator : Action + { + public enum Operation + { + Add, + Subtract, + Multiply, + Divide, + Min, + Max, + Modulo + } + + [Tooltip("The operation to perform")] + public Operation operation; + [Tooltip("The first integer")] + public SharedInt integer1; + [Tooltip("The second integer")] + public SharedInt integer2; + [RequiredField] + [Tooltip("The variable to store the result")] + public SharedInt storeResult; + + public override TaskStatus OnUpdate() + { + switch (operation) { + case Operation.Add: + storeResult.Value = integer1.Value + integer2.Value; + break; + case Operation.Subtract: + storeResult.Value = integer1.Value - integer2.Value; + break; + case Operation.Multiply: + storeResult.Value = integer1.Value * integer2.Value; + break; + case Operation.Divide: + storeResult.Value = integer1.Value / integer2.Value; + break; + case Operation.Min: + storeResult.Value = Mathf.Min(integer1.Value, integer2.Value); + break; + case Operation.Max: + storeResult.Value = Mathf.Max(integer1.Value, integer2.Value); + break; + case Operation.Modulo: + storeResult.Value = integer1.Value % integer2.Value; + break; + } + return TaskStatus.Success; + } + + public override void OnReset() + { + operation = Operation.Add; + integer1 = 0; + integer2 = 0; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntOperator.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntOperator.cs.meta new file mode 100644 index 000000000..cfc0ff1c3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntOperator.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 84208004fb80c0945acc5685aa0a2681 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IntOperator.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IsFloatPositive.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IsFloatPositive.cs new file mode 100644 index 000000000..076b93f36 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IsFloatPositive.cs @@ -0,0 +1,20 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Is the float a positive value?")] + public class IsFloatPositive : Conditional + { + [Tooltip("The float to check if positive")] + public SharedFloat floatVariable; + + public override TaskStatus OnUpdate() + { + return floatVariable.Value > 0 ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + floatVariable = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IsFloatPositive.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IsFloatPositive.cs.meta new file mode 100644 index 000000000..c0e96590a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IsFloatPositive.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: db01d0da1f282134ca0ff7332eb19208 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IsFloatPositive.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IsIntPositive.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IsIntPositive.cs new file mode 100644 index 000000000..a69e35128 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IsIntPositive.cs @@ -0,0 +1,20 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Is the int a positive value?")] + public class IsIntPositive : Conditional + { + [Tooltip("The int to check if positive")] + public SharedInt intVariable; + + public override TaskStatus OnUpdate() + { + return intVariable.Value > 0 ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + intVariable = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IsIntPositive.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IsIntPositive.cs.meta new file mode 100644 index 000000000..278d7a697 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IsIntPositive.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 0caff63c23ae17343a455fcbe6eab40a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/IsIntPositive.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/Lerp.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/Lerp.cs new file mode 100644 index 000000000..384f591dd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/Lerp.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Lerp the float by an amount.")] + public class Lerp : Action + { + [Tooltip("The from value")] + public SharedFloat fromValue; + [Tooltip("The to value")] + public SharedFloat toValue; + [Tooltip("The amount to lerp")] + public SharedFloat lerpAmount; + [Tooltip("The lerp resut")] + [RequiredField] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Mathf.Lerp(fromValue.Value, toValue.Value, lerpAmount.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + fromValue = 0; + toValue = 0; + lerpAmount = 0; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/Lerp.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/Lerp.cs.meta new file mode 100644 index 000000000..83dc68e32 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/Lerp.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 355f3f83182cc434cb3a1bfb66862e29 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/Lerp.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/LerpAngle.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/LerpAngle.cs new file mode 100644 index 000000000..dcde263ee --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/LerpAngle.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Lerp the angle by an amount.")] + public class LerpAngle : Action + { + [Tooltip("The from value")] + public SharedFloat fromValue; + [Tooltip("The to value")] + public SharedFloat toValue; + [Tooltip("The amount to lerp")] + public SharedFloat lerpAmount; + [Tooltip("The lerp resut")] + [RequiredField] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Mathf.LerpAngle(fromValue.Value, toValue.Value, lerpAmount.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + fromValue = 0; + toValue = 0; + lerpAmount = 0; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/LerpAngle.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/LerpAngle.cs.meta new file mode 100644 index 000000000..882117ccf --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/LerpAngle.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c3b148edcb926b744a2bb789f7967e24 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/LerpAngle.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomBool.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomBool.cs new file mode 100644 index 000000000..8a2e2fa55 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomBool.cs @@ -0,0 +1,18 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Sets a random bool value")] + public class RandomBool : Action + { + [Tooltip("The variable to store the result")] + public SharedBool storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Random.value < 0.5f; + return TaskStatus.Success; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomBool.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomBool.cs.meta new file mode 100644 index 000000000..f3eae999c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomBool.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 76d2565ca99ca26459dbefb44dcac109 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomBool.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomFloat.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomFloat.cs new file mode 100644 index 000000000..1c6ef2ebf --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomFloat.cs @@ -0,0 +1,36 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Sets a random float value")] + public class RandomFloat : Action + { + [Tooltip("The minimum amount")] + public SharedFloat min; + [Tooltip("The maximum amount")] + public SharedFloat max; + [Tooltip("Is the maximum value inclusive?")] + public bool inclusive; + [Tooltip("The variable to store the result")] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + if (inclusive) { + storeResult.Value = Random.Range(min.Value, max.Value); + } else { + storeResult.Value = Random.Range(min.Value, max.Value - 0.00001f); + } + return TaskStatus.Success; + } + + public override void OnReset() + { + min.Value = 0; + max.Value = 0; + inclusive = false; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomFloat.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomFloat.cs.meta new file mode 100644 index 000000000..9d9f46173 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomFloat.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9f81e111c77731b418178f1226975c3f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomFloat.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomInt.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomInt.cs new file mode 100644 index 000000000..7ac570895 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomInt.cs @@ -0,0 +1,36 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Sets a random int value")] + public class RandomInt : Action + { + [Tooltip("The minimum amount")] + public SharedInt min; + [Tooltip("The maximum amount")] + public SharedInt max; + [Tooltip("Is the maximum value inclusive?")] + public bool inclusive; + [Tooltip("The variable to store the result")] + public SharedInt storeResult; + + public override TaskStatus OnUpdate() + { + if (inclusive) { + storeResult.Value = Random.Range(min.Value, max.Value + 1); + } else { + storeResult.Value = Random.Range(min.Value, max.Value); + } + return TaskStatus.Success; + } + + public override void OnReset() + { + min.Value = 0; + max.Value = 0; + inclusive = false; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomInt.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomInt.cs.meta new file mode 100644 index 000000000..5d35be1d9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomInt.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 067384c41f33cff49bcdf6adec9da049 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/RandomInt.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetBool.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetBool.cs new file mode 100644 index 000000000..f95dced4b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetBool.cs @@ -0,0 +1,23 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Sets a bool value")] + public class SetBool : Action + { + [Tooltip("The bool value to set")] + public SharedBool boolValue; + [Tooltip("The variable to store the result")] + public SharedBool storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = boolValue.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + boolValue = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetBool.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetBool.cs.meta new file mode 100644 index 000000000..a37807fd1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetBool.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 55f244424a532d24bba59542e2f0fc59 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetBool.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetFloat.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetFloat.cs new file mode 100644 index 000000000..11f79a6cd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetFloat.cs @@ -0,0 +1,24 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Sets a float value")] + public class SetFloat : Action + { + [Tooltip("The float value to set")] + public SharedFloat floatValue; + [Tooltip("The variable to store the result")] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = floatValue.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + floatValue = 0; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetFloat.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetFloat.cs.meta new file mode 100644 index 000000000..044bd02a2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetFloat.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4d915065ba447c64ba05f8e2841c6efd +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetFloat.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetInt.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetInt.cs new file mode 100644 index 000000000..03af02d04 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetInt.cs @@ -0,0 +1,24 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.Math +{ + [TaskCategory("Unity/Math")] + [TaskDescription("Sets an int value")] + public class SetInt : Action + { + [Tooltip("The int value to set")] + public SharedInt intValue; + [Tooltip("The variable to store the result")] + public SharedInt storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = intValue.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + intValue = 0; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetInt.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetInt.cs.meta new file mode 100644 index 000000000..c021bd024 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetInt.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: da57a0a43f227e445b9311bae043401f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Math/SetInt.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent.meta new file mode 100644 index 000000000..bbaf1415b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 7e052e6171d06ed43bea8c8143e7bce5 +folderAsset: yes +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetAcceleration.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetAcceleration.cs new file mode 100644 index 000000000..58945db11 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetAcceleration.cs @@ -0,0 +1,47 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Gets the maximum acceleration of an agent as it follows a path, given in units / sec^2.. Returns Success.")] + public class GetAcceleration : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [SharedRequired] + [Tooltip("The NavMeshAgent acceleration")] + public SharedFloat storeValue; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + storeValue.Value = navMeshAgent.acceleration; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetAcceleration.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetAcceleration.cs.meta new file mode 100644 index 000000000..2bee13d9f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetAcceleration.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7e00211632663cc43bc88ab068ab5d44 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetAcceleration.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetAngularSpeed.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetAngularSpeed.cs new file mode 100644 index 000000000..d912e57e1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetAngularSpeed.cs @@ -0,0 +1,47 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Gets the maximum turning speed in (deg/s) while following a path.. Returns Success.")] + public class GetAngularSpeed : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [SharedRequired] + [Tooltip("The NavMeshAgent angular speed")] + public SharedFloat storeValue; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + storeValue.Value = navMeshAgent.angularSpeed; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetAngularSpeed.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetAngularSpeed.cs.meta new file mode 100644 index 000000000..bb5b26774 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetAngularSpeed.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 110bcd7b4d1baae4096b5da6737c1e16 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetAngularSpeed.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetDestination.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetDestination.cs new file mode 100644 index 000000000..a937e61c4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetDestination.cs @@ -0,0 +1,47 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Gets the destination of the agent in world-space units. Returns Success.")] + public class GetDestination : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [SharedRequired] + [Tooltip("The NavMeshAgent destination")] + public SharedVector3 storeValue; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + storeValue.Value = navMeshAgent.destination; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetDestination.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetDestination.cs.meta new file mode 100644 index 000000000..8135d86e3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetDestination.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4368ae3e22d36604697d420dff004cbe +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetDestination.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetIsStopped.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetIsStopped.cs new file mode 100644 index 000000000..1c5328a4c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetIsStopped.cs @@ -0,0 +1,47 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Gets the stop status. Returns Success.")] + public class GetIsStopped : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [SharedRequired] + [Tooltip("The stop status")] + public SharedBool storeValue; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + storeValue.Value = navMeshAgent.isStopped; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = null; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetIsStopped.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetIsStopped.cs.meta new file mode 100644 index 000000000..7b2a17163 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetIsStopped.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 16a58d9763ce6c34690e0946a64c4176 +timeCreated: 1507381813 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetIsStopped.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetRemainingDistance.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetRemainingDistance.cs new file mode 100644 index 000000000..782ef8c62 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetRemainingDistance.cs @@ -0,0 +1,47 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Gets the distance between the agent's position and the destination on the current path. Returns Success.")] + public class GetRemainingDistance : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [SharedRequired] + [Tooltip("The remaining distance")] + public SharedFloat storeValue; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + storeValue.Value = navMeshAgent.remainingDistance; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetRemainingDistance.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetRemainingDistance.cs.meta new file mode 100644 index 000000000..b5ab6ad52 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetRemainingDistance.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ab046b37543b6744aa440cd708a93b81 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetRemainingDistance.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetSpeed.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetSpeed.cs new file mode 100644 index 000000000..6e18c9da1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetSpeed.cs @@ -0,0 +1,47 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Gets the maximum movement speed when following a path. Returns Success.")] + public class GetSpeed : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [SharedRequired] + [Tooltip("The NavMeshAgent speed")] + public SharedFloat storeValue; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + storeValue.Value = navMeshAgent.speed; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetSpeed.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetSpeed.cs.meta new file mode 100644 index 000000000..8ff3f0c13 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetSpeed.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b6397854a3aea4b44a5ab4ccf98d082d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/GetSpeed.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/IsStopped.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/IsStopped.cs new file mode 100644 index 000000000..aea54fafc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/IsStopped.cs @@ -0,0 +1,41 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Is the agent stopped?")] + public class IsStopped : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + return navMeshAgent.isStopped ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/IsStopped.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/IsStopped.cs.meta new file mode 100644 index 000000000..f2a762441 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/IsStopped.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 1b7f86ab194623f4997c385d2cce0caf +timeCreated: 1507329647 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/IsStopped.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Move.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Move.cs new file mode 100644 index 000000000..a7c480896 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Move.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Apply relative movement to the current position. Returns Success.")] + public class Move : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The relative movement vector")] + public SharedVector3 offset; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + navMeshAgent.Move(offset.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + offset = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Move.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Move.cs.meta new file mode 100644 index 000000000..1b2ee1c30 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Move.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 55ea16e678f6fae47a46affd3d22b883 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Move.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/ResetPath.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/ResetPath.cs new file mode 100644 index 000000000..0c1357022 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/ResetPath.cs @@ -0,0 +1,43 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Clears the current path. Returns Success.")] + public class ResetPath : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + navMeshAgent.ResetPath(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/ResetPath.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/ResetPath.cs.meta new file mode 100644 index 000000000..ce66769dd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/ResetPath.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e90973887b9e7d04aafc5d13ecdfc8b9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/ResetPath.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Resume.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Resume.cs new file mode 100644 index 000000000..4faf7ad3e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Resume.cs @@ -0,0 +1,43 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Resumes the movement along the current path after a pause. Returns Success.")] + public class Resume : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + navMeshAgent.isStopped = false; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Resume.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Resume.cs.meta new file mode 100644 index 000000000..3b49b6be3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Resume.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2c87e343e0ec23041b0cf7d8090d4814 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Resume.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetAcceleration.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetAcceleration.cs new file mode 100644 index 000000000..3552b5a2e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetAcceleration.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Sets the maximum acceleration of an agent as it follows a path, given in units / sec^2. Returns Success.")] + public class SetAcceleration : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The NavMeshAgent acceleration")] + public SharedFloat acceleration; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + navMeshAgent.acceleration = acceleration.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + acceleration = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetAcceleration.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetAcceleration.cs.meta new file mode 100644 index 000000000..bd328afe5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetAcceleration.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a8357209bccc16442b549c580872bb05 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetAcceleration.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetAngularSpeed.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetAngularSpeed.cs new file mode 100644 index 000000000..1fa682f6a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetAngularSpeed.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Sets the maximum turning speed in (deg/s) while following a path. Returns Success.")] + public class SetAngularSpeed : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The NavMeshAgent angular speed")] + public SharedFloat angularSpeed; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + navMeshAgent.angularSpeed = angularSpeed.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + angularSpeed = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetAngularSpeed.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetAngularSpeed.cs.meta new file mode 100644 index 000000000..3495f08f9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetAngularSpeed.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 0d8e213aa17540848b83b17ba1609c74 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetAngularSpeed.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetDestination.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetDestination.cs new file mode 100644 index 000000000..0ec07bc15 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetDestination.cs @@ -0,0 +1,45 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Sets the destination of the agent in world-space units. Returns Success if the destination is valid.")] + public class SetDestination: Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [SharedRequired] + [Tooltip("The NavMeshAgent destination")] + public SharedVector3 destination; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + return navMeshAgent.SetDestination(destination.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + destination = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetDestination.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetDestination.cs.meta new file mode 100644 index 000000000..e2c4d1985 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetDestination.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 55d9c2d20e895104181ae1b484868ead +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetDestination.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetIsStopped.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetIsStopped.cs new file mode 100644 index 000000000..36ad7a593 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetIsStopped.cs @@ -0,0 +1,45 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Sets the stop status. Returns Success.")] + public class SetIsStopped : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The stop status")] + public SharedBool isStopped; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + navMeshAgent.isStopped = isStopped.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetIsStopped.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetIsStopped.cs.meta new file mode 100644 index 000000000..706b8793a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetIsStopped.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 8b7446e67db5ff34a88b8fbc7899e5e9 +timeCreated: 1507381999 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetIsStopped.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetSpeed.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetSpeed.cs new file mode 100644 index 000000000..d54f91e84 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetSpeed.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Sets the maximum movement speed when following a path. Returns Success.")] + public class SetSpeed : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The NavMeshAgent speed")] + public SharedFloat speed; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + navMeshAgent.speed = speed.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + speed = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetSpeed.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetSpeed.cs.meta new file mode 100644 index 000000000..512551cd4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetSpeed.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 34372b45870504b419f34165fb1fa4fb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/SetSpeed.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Stop.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Stop.cs new file mode 100644 index 000000000..f168fc61e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Stop.cs @@ -0,0 +1,43 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Stop movement of this agent along its current path. Returns Success.")] + public class Stop : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + navMeshAgent.isStopped = true; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Stop.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Stop.cs.meta new file mode 100644 index 000000000..29ecfba6f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Stop.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b20958b8b92e47f40ba3178c99576182 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Stop.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Warp.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Warp.cs new file mode 100644 index 000000000..37b0bdf1b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Warp.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using UnityEngine.AI; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityNavMeshAgent +{ + [TaskCategory("Unity/NavMeshAgent")] + [TaskDescription("Warps agent to the provided position. Returns Success.")] + public class Warp : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The position to warp to")] + public SharedVector3 newPosition; + + // cache the navmeshagent component + private NavMeshAgent navMeshAgent; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + navMeshAgent = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (navMeshAgent == null) { + Debug.LogWarning("NavMeshAgent is null"); + return TaskStatus.Failure; + } + + navMeshAgent.Warp(newPosition.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + newPosition = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Warp.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Warp.cs.meta new file mode 100644 index 000000000..5d3f6ca8c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Warp.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9d2356bfaf0a64b4d9d65d32708630db +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/NavMeshAgent/Warp.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem.meta new file mode 100644 index 000000000..7cee88f91 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 298b24307673c7a49b5cabe1dbcae115 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Clear.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Clear.cs new file mode 100644 index 000000000..d6ffc68c0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Clear.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Clear the Particle System.")] + public class Clear : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + particleSystem.Clear(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Clear.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Clear.cs.meta new file mode 100644 index 000000000..0f27428fc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Clear.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: de273e542591d5946a8728190438ae27 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Clear.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetDuration.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetDuration.cs new file mode 100644 index 000000000..ef2f9c945 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetDuration.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Stores the duration of the Particle System.")] + public class GetDuration : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The duration of the ParticleSystem")] + [RequiredField] + public SharedFloat storeResult; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + storeResult.Value = particleSystem.main.duration; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetDuration.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetDuration.cs.meta new file mode 100644 index 000000000..c353ab960 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetDuration.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 02a4d610e82f1854c87701c4d51957fb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetDuration.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetEnableEmission.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetEnableEmission.cs new file mode 100644 index 000000000..6313f4fad --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetEnableEmission.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Stores if the Particle System is emitting particles.")] + public class GetEnableEmission : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Is the Particle System emitting particles?")] + [RequiredField] + public SharedBool storeResult; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + storeResult.Value = particleSystem.emission.enabled; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetEnableEmission.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetEnableEmission.cs.meta new file mode 100644 index 000000000..47e017641 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetEnableEmission.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 81dc1a241a2c872409a7919742df7581 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetEnableEmission.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetLoop.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetLoop.cs new file mode 100644 index 000000000..ca5417038 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetLoop.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Stores if the Particle System should loop.")] + public class GetLoop : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Should the ParticleSystem loop?")] + [RequiredField] + public SharedBool storeResult; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + storeResult.Value = particleSystem.main.loop; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = false; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetLoop.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetLoop.cs.meta new file mode 100644 index 000000000..b1eacc23c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetLoop.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 82f4ee8cf50887a4488fe6d0da18afc0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetLoop.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetMaxParticles.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetMaxParticles.cs new file mode 100644 index 000000000..a3344e494 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetMaxParticles.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Stores the max particles of the Particle System.")] + public class GetMaxParticles : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The max particles of the ParticleSystem")] + [RequiredField] + public SharedFloat storeResult; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + storeResult.Value = particleSystem.main.maxParticles; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetMaxParticles.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetMaxParticles.cs.meta new file mode 100644 index 000000000..f1cd10528 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetMaxParticles.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 429771af65df81c49aaf4b34630473fe +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetMaxParticles.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetParticleCount.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetParticleCount.cs new file mode 100644 index 000000000..c5b6e664f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetParticleCount.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Stores the particle count of the Particle System.")] + public class GetParticleCount : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The particle count of the ParticleSystem")] + [RequiredField] + public SharedFloat storeResult; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + storeResult.Value = particleSystem.particleCount; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetParticleCount.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetParticleCount.cs.meta new file mode 100644 index 000000000..ce61b38bc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetParticleCount.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f32e2ff9de4ff7b47a256ac3b51123c6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetParticleCount.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetPlaybackSpeed.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetPlaybackSpeed.cs new file mode 100644 index 000000000..8a7b93e98 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetPlaybackSpeed.cs @@ -0,0 +1,46 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Stores the playback speed of the Particle System.")] + public class GetPlaybackSpeed : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The playback speed of the ParticleSystem")] + [RequiredField] + public SharedFloat storeResult; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + ParticleSystem.MainModule mainParticleSystem = particleSystem.main; + storeResult.Value = mainParticleSystem.simulationSpeed; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetPlaybackSpeed.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetPlaybackSpeed.cs.meta new file mode 100644 index 000000000..69bf7fc88 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetPlaybackSpeed.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f8f29f170ac706b498e7c933136d8036 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetPlaybackSpeed.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetTime.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetTime.cs new file mode 100644 index 000000000..c9f73dad6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetTime.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Stores the time of the Particle System.")] + public class GetTime : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The time of the ParticleSystem")] + [RequiredField] + public SharedFloat storeResult; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + storeResult.Value = particleSystem.time; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetTime.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetTime.cs.meta new file mode 100644 index 000000000..7cfe229e5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetTime.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9b15c7efbf98f7649adf8dd4474b0579 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/GetTime.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsAlive.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsAlive.cs new file mode 100644 index 000000000..baef730e5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsAlive.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Is the Particle System alive?")] + public class IsAlive : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + return particleSystem.IsAlive() ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsAlive.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsAlive.cs.meta new file mode 100644 index 000000000..885413e25 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsAlive.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3d554784e9a9fa040a2446402ba3f10e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsAlive.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsPaused.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsPaused.cs new file mode 100644 index 000000000..53b61fc75 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsPaused.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Is the Particle System paused?")] + public class IsPaused : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + return particleSystem.isPaused ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsPaused.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsPaused.cs.meta new file mode 100644 index 000000000..290d38455 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsPaused.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e4e9ab132f20dfa4095b3c90303ebf74 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsPaused.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsPlaying.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsPlaying.cs new file mode 100644 index 000000000..d27d63bdb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsPlaying.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Is the Particle System playing?")] + public class IsPlaying : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + return particleSystem.isPlaying ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsPlaying.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsPlaying.cs.meta new file mode 100644 index 000000000..a4cf0c48c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsPlaying.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 654b51e99f64bfb489e12866a569f00e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsPlaying.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsStopped.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsStopped.cs new file mode 100644 index 000000000..2820df745 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsStopped.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Is the Particle System stopped?")] + public class IsStopped : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + return particleSystem.isStopped ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsStopped.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsStopped.cs.meta new file mode 100644 index 000000000..2703715c3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsStopped.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c719a7379c22b184380b4e63ccdfd064 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/IsStopped.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Pause.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Pause.cs new file mode 100644 index 000000000..dc93485c9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Pause.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Pause the Particle System.")] + public class Pause : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + particleSystem.Pause(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Pause.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Pause.cs.meta new file mode 100644 index 000000000..c0b4b974a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Pause.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c9c9cc56691817b49af4fd1cfbc3e363 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Pause.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Play.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Play.cs new file mode 100644 index 000000000..907aba4d6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Play.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Play the Particle System.")] + public class Play : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + particleSystem.Play(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Play.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Play.cs.meta new file mode 100644 index 000000000..32a9a7bd1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Play.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a8ffb889d35074d4fb08d8502155c0b2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Play.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetEnableEmission.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetEnableEmission.cs new file mode 100644 index 000000000..8248738c2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetEnableEmission.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Enables or disables the Particle System emission.")] + public class SetEnableEmission : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Enable the ParticleSystem emissions?")] + public SharedBool enable; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + var emission = particleSystem.emission; + emission.enabled = enable.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + enable = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetEnableEmission.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetEnableEmission.cs.meta new file mode 100644 index 000000000..a56dbb83e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetEnableEmission.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f7c295b4d24628146a885d21bf699993 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetEnableEmission.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetLoop.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetLoop.cs new file mode 100644 index 000000000..ea13ccd01 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetLoop.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Sets if the Particle System should loop.")] + public class SetLoop : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Should the ParticleSystem loop?")] + public SharedBool loop; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + ParticleSystem.MainModule mainParticleSystem = particleSystem.main; + mainParticleSystem.loop = loop.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + loop = false; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetLoop.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetLoop.cs.meta new file mode 100644 index 000000000..42ce513eb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetLoop.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b9fa90adc0377cc4592de00e410a4060 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetLoop.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetMaxParticles.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetMaxParticles.cs new file mode 100644 index 000000000..e37909e61 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetMaxParticles.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Sets the max particles of the Particle System.")] + public class SetMaxParticles : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The max particles of the ParticleSystem")] + public SharedInt maxParticles; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + ParticleSystem.MainModule mainParticleSystem = particleSystem.main; + mainParticleSystem.maxParticles = maxParticles.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + maxParticles = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetMaxParticles.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetMaxParticles.cs.meta new file mode 100644 index 000000000..97b45706e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetMaxParticles.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: eadca930ad32a404886060ee43e4d802 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetMaxParticles.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetPlaybackSpeed.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetPlaybackSpeed.cs new file mode 100644 index 000000000..e4eabc6db --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetPlaybackSpeed.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Sets the playback speed of the Particle System.")] + public class SetPlaybackSpeed : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The playback speed of the ParticleSystem")] + public SharedFloat playbackSpeed = 1; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + ParticleSystem.MainModule mainParticleSystem = particleSystem.main; + mainParticleSystem.simulationSpeed = playbackSpeed.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + playbackSpeed = 1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetPlaybackSpeed.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetPlaybackSpeed.cs.meta new file mode 100644 index 000000000..435efbf0d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetPlaybackSpeed.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8f4d79e34ac8820458a2813895d3962d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetPlaybackSpeed.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartColor.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartColor.cs new file mode 100644 index 000000000..43a2f88ee --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartColor.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Sets the start color of the Particle System.")] + public class SetStartColor : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The start color of the ParticleSystem")] + public SharedColor startColor; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + ParticleSystem.MainModule mainParticleSystem = particleSystem.main; + mainParticleSystem.startColor = startColor.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + startColor = Color.white; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartColor.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartColor.cs.meta new file mode 100644 index 000000000..a02cd33b4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartColor.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f91be163d0c01ec42bf120c267dcceea +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartColor.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartDelay.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartDelay.cs new file mode 100644 index 000000000..e56181cd4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartDelay.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Sets the start delay of the Particle System.")] + public class SetStartDelay : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The start delay of the ParticleSystem")] + public SharedFloat startDelay; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + ParticleSystem.MainModule mainParticleSystem = particleSystem.main; + mainParticleSystem.startDelay = startDelay.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + startDelay = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartDelay.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartDelay.cs.meta new file mode 100644 index 000000000..bff8d55d0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartDelay.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 532026cf3b430c840897e66bdde5006e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartDelay.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartLifetime.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartLifetime.cs new file mode 100644 index 000000000..627f5a330 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartLifetime.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Sets the start lifetime of the Particle System.")] + public class SetStartLifetime : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The start lifetime of the ParticleSystem")] + public SharedFloat startLifetime; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + ParticleSystem.MainModule mainParticleSystem = particleSystem.main; + mainParticleSystem.startLifetime = startLifetime.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + startLifetime = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartLifetime.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartLifetime.cs.meta new file mode 100644 index 000000000..49e11b3d1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartLifetime.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 311b9ed850b4e2243ae44487b9ece819 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartLifetime.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartRotation.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartRotation.cs new file mode 100644 index 000000000..cd00f9673 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartRotation.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Sets the start rotation of the Particle System.")] + public class SetStartRotation : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The start rotation of the ParticleSystem")] + public SharedFloat startRotation; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + ParticleSystem.MainModule mainParticleSystem = particleSystem.main; + mainParticleSystem.startRotation = startRotation.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + startRotation = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartRotation.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartRotation.cs.meta new file mode 100644 index 000000000..f8299a0c4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartRotation.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ae611ab09913de6438aeb81d7a621c51 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartRotation.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartSize.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartSize.cs new file mode 100644 index 000000000..cef0ef80b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartSize.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Sets the start size of the Particle System.")] + public class SetStartSize : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The start size of the ParticleSystem")] + public SharedFloat startSize; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + ParticleSystem.MainModule mainParticleSystem = particleSystem.main; + mainParticleSystem.startSize = startSize.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + startSize = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartSize.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartSize.cs.meta new file mode 100644 index 000000000..c315d88d9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartSize.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d7be6a1da3f4f7a418e5739a6cc6e78e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartSize.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartSpeed.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartSpeed.cs new file mode 100644 index 000000000..4856dd280 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartSpeed.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Sets the start speed of the Particle System.")] + public class SetStartSpeed : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The start speed of the ParticleSystem")] + public SharedFloat startSpeed; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + ParticleSystem.MainModule mainParticleSystem = particleSystem.main; + mainParticleSystem.startSpeed = startSpeed.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + startSpeed = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartSpeed.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartSpeed.cs.meta new file mode 100644 index 000000000..669d92e5f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartSpeed.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b7716318475d3854a96729d1a7540d4a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetStartSpeed.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetTime.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetTime.cs new file mode 100644 index 000000000..35e9e429d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetTime.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Sets the time of the Particle System.")] + public class SetTime : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The time of the ParticleSystem")] + public SharedFloat time; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + particleSystem.time = time.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + time = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetTime.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetTime.cs.meta new file mode 100644 index 000000000..2335d3aa1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetTime.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 103e78e9c755fe3469e63115eb1c0d80 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/SetTime.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Simulate.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Simulate.cs new file mode 100644 index 000000000..0c7541211 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Simulate.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Simulate the Particle System.")] + public class Simulate : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Time to fastfoward the Particle System to")] + public SharedFloat time; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + particleSystem.Simulate(time.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + time = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Simulate.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Simulate.cs.meta new file mode 100644 index 000000000..a76c2cda7 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Simulate.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 24d79d661acf61e44918320624b49dd5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Simulate.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Stop.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Stop.cs new file mode 100644 index 000000000..291184730 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Stop.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityParticleSystem +{ + [TaskCategory("Unity/ParticleSystem")] + [TaskDescription("Stop the Particle System.")] + public class Stop : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + particleSystem.Stop(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Stop.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Stop.cs.meta new file mode 100644 index 000000000..d5c93e15a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Stop.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fd83617024d6bff44824a83b472db8e6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/ParticleSystem/Stop.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics.meta new file mode 100644 index 000000000..267455f17 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: f029d04458be91f4d9b9bec1c9ccfde7 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Linecast.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Linecast.cs new file mode 100644 index 000000000..1abefa760 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Linecast.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPhysics +{ + [TaskCategory("Unity/Physics")] + [TaskDescription("Returns success if there is any collider intersecting the line between start and end")] + public class Linecast : Action + { + [Tooltip("The starting position of the linecast")] + public SharedVector3 startPosition; + [Tooltip("The ending position of the linecast")] + public SharedVector3 endPosition; + [Tooltip("Selectively ignore colliders.")] + public LayerMask layerMask = -1; + + public override TaskStatus OnUpdate() + { + return Physics.Linecast(startPosition.Value, endPosition.Value, layerMask) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + startPosition = Vector3.zero; + endPosition = Vector3.zero; + layerMask = -1; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Linecast.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Linecast.cs.meta new file mode 100644 index 000000000..e5db89935 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Linecast.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 163f5567b8906cd45adf138c3c022152 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Linecast.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Raycast.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Raycast.cs new file mode 100644 index 000000000..1c163dd60 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Raycast.cs @@ -0,0 +1,70 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPhysics +{ + [TaskCategory("Unity/Physics")] + [TaskDescription("Casts a ray against all colliders in the scene. Returns success if a collider was hit.")] + public class Raycast : Action + { + [Tooltip("Starts the ray at the GameObject's position. If null the originPosition will be used")] + public SharedGameObject originGameObject; + [Tooltip("Starts the ray at the position. Only used if originGameObject is null")] + public SharedVector3 originPosition; + [Tooltip("The direction of the ray")] + public SharedVector3 direction; + [Tooltip("The length of the ray. Set to -1 for infinity")] + public SharedFloat distance = -1; + [Tooltip("Selectively ignore colliders")] + public LayerMask layerMask = -1; + [Tooltip("Cast the ray in world or local space. The direction is in world space if no GameObject is specified")] + public Space space = Space.Self; + + [SharedRequired] + [Tooltip("Stores the hit object of the raycast")] + public SharedGameObject storeHitObject; + [SharedRequired] + [Tooltip("Stores the hit point of the raycast")] + public SharedVector3 storeHitPoint; + [SharedRequired] + [Tooltip("Stores the hit normal of the raycast")] + public SharedVector3 storeHitNormal; + [SharedRequired] + [Tooltip("Stores the hit distance of the raycast")] + public SharedFloat storeHitDistance; + + public override TaskStatus OnUpdate() + { + Vector3 position; + Vector3 dir = direction.Value; + if (originGameObject.Value != null) { + position = originGameObject.Value.transform.position; + if (space == Space.Self) { + dir = originGameObject.Value.transform.TransformDirection(direction.Value); + } + } else { + position = originPosition.Value; + } + + RaycastHit hit; + if (Physics.Raycast(position, dir, out hit, distance.Value == -1 ? Mathf.Infinity : distance.Value, layerMask)) { + storeHitObject.Value = hit.collider.gameObject; + storeHitPoint.Value = hit.point; + storeHitNormal.Value = hit.normal; + storeHitDistance.Value = hit.distance; + return TaskStatus.Success; + } + + return TaskStatus.Failure; + } + + public override void OnReset() + { + originGameObject = null; + originPosition = Vector3.zero; + direction = Vector3.zero; + distance = -1; + layerMask = -1; + space = Space.Self; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Raycast.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Raycast.cs.meta new file mode 100644 index 000000000..f6d50d11b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Raycast.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: afcf9d39edef45146ad7a043b8bfa76e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Raycast.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Spherecast.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Spherecast.cs new file mode 100644 index 000000000..d168e2f2b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Spherecast.cs @@ -0,0 +1,73 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPhysics +{ + [TaskCategory("Unity/Physics")] + [TaskDescription("Casts a sphere against all colliders in the scene. Returns success if a collider was hit.")] + public class SphereCast : Action + { + [Tooltip("Starts the spherecast at the GameObject's position. If null the originPosition will be used")] + public SharedGameObject originGameObject; + [Tooltip("Starts the sherecast at the position. Only used if originGameObject is null")] + public SharedVector3 originPosition; + [Tooltip("The radius of the spherecast")] + public SharedFloat radius; + [Tooltip("The direction of the spherecast")] + public SharedVector3 direction; + [Tooltip("The length of the spherecast. Set to -1 for infinity")] + public SharedFloat distance = -1; + [Tooltip("Selectively ignore colliders")] + public LayerMask layerMask = -1; + [Tooltip("Use world or local space. The direction is in world space if no GameObject is specified")] + public Space space = Space.Self; + + [SharedRequired] + [Tooltip("Stores the hit object of the spherecast")] + public SharedGameObject storeHitObject; + [SharedRequired] + [Tooltip("Stores the hit point of the spherecast")] + public SharedVector3 storeHitPoint; + [SharedRequired] + [Tooltip("Stores the hit normal of the spherecast")] + public SharedVector3 storeHitNormal; + [SharedRequired] + [Tooltip("Stores the hit distance of the spherecast")] + public SharedFloat storeHitDistance; + + public override TaskStatus OnUpdate() + { + Vector3 position; + Vector3 dir = direction.Value; + if (originGameObject.Value != null) { + position = originGameObject.Value.transform.position; + if (space == Space.Self) { + dir = originGameObject.Value.transform.TransformDirection(direction.Value); + } + } else { + position = originPosition.Value; + } + + RaycastHit hit; + if (Physics.SphereCast(position, radius.Value, dir, out hit, distance.Value == -1 ? Mathf.Infinity : distance.Value, layerMask)) { + storeHitObject.Value = hit.collider.gameObject; + storeHitPoint.Value = hit.point; + storeHitNormal.Value = hit.normal; + storeHitDistance.Value = hit.distance; + return TaskStatus.Success; + } + + return TaskStatus.Failure; + } + + public override void OnReset() + { + originGameObject = null; + originPosition = Vector3.zero; + radius = 0; + direction = Vector3.zero; + distance = -1; + layerMask = -1; + space = Space.Self; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Spherecast.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Spherecast.cs.meta new file mode 100644 index 000000000..9ef438e58 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Spherecast.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2058f3f94c5bdf5409f9ff80ea61d44a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Physics/Spherecast.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D.meta new file mode 100644 index 000000000..57df9f4ca --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 056a8d0f58dcb4749949548a468e90c0 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Circlecast.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Circlecast.cs new file mode 100644 index 000000000..e00abdcaf --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Circlecast.cs @@ -0,0 +1,72 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPhysics2D +{ + [TaskCategory("Unity/Physics2D")] + [TaskDescription("Casts a circle against all colliders in the scene. Returns success if a collider was hit.")] + public class Circlecast : Action + { + [Tooltip("Starts the circlecast at the GameObject's position. If null the originPosition will be used.")] + public SharedGameObject originGameObject; + [Tooltip("Starts the circlecast at the position. Only used if originGameObject is null.")] + public SharedVector2 originPosition; + [Tooltip("The radius of the circlecast")] + public SharedFloat radius; + [Tooltip("The direction of the circlecast")] + public SharedVector2 direction; + [Tooltip("The length of the ray. Set to -1 for infinity.")] + public SharedFloat distance = -1; + [Tooltip("Selectively ignore colliders.")] + public LayerMask layerMask = -1; + [Tooltip("Use world or local space. The direction is in world space if no GameObject is specified.")] + public Space space = Space.Self; + + [SharedRequired] + [Tooltip("Stores the hit object of the circlecast.")] + public SharedGameObject storeHitObject; + [SharedRequired] + [Tooltip("Stores the hit point of the circlecast.")] + public SharedVector2 storeHitPoint; + [SharedRequired] + [Tooltip("Stores the hit normal of the circlecast.")] + public SharedVector2 storeHitNormal; + [SharedRequired] + [Tooltip("Stores the hit distance of the circlecast.")] + public SharedFloat storeHitDistance; + + public override TaskStatus OnUpdate() + { + Vector2 position; + Vector2 dir = direction.Value; + if (originGameObject.Value != null) { + position = originGameObject.Value.transform.position; + if (space == Space.Self) { + dir = originGameObject.Value.transform.TransformDirection(direction.Value); + } + } else { + position = originPosition.Value; + } + + var hit = Physics2D.CircleCast(position, radius.Value, dir, distance.Value == -1 ? Mathf.Infinity : distance.Value, layerMask); + if (hit.collider != null) { + storeHitObject.Value = hit.collider.gameObject; + storeHitPoint.Value = hit.point; + storeHitNormal.Value = hit.normal; + storeHitDistance.Value = hit.distance; + return TaskStatus.Success; + } + return TaskStatus.Failure; + } + + public override void OnReset() + { + originGameObject = null; + originPosition = Vector2.zero; + direction = Vector2.zero; + radius = 0; + distance = -1; + layerMask = -1; + space = Space.Self; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Circlecast.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Circlecast.cs.meta new file mode 100644 index 000000000..2c0e9b9d3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Circlecast.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6989aa8730764ee459a07f88d84302e0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Circlecast.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Linecast.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Linecast.cs new file mode 100644 index 000000000..8f83668a3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Linecast.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPhysics2D +{ + [TaskCategory("Unity/Physics2D")] + [TaskDescription("Returns success if there is any collider intersecting the line between start and end")] + public class Linecast : Action + { + [Tooltip("The starting position of the linecast.")] + public SharedVector2 startPosition; + [Tooltip("The ending position of the linecast.")] + public SharedVector2 endPosition; + [Tooltip("Selectively ignore colliders.")] + public LayerMask layerMask = -1; + + public override TaskStatus OnUpdate() + { + return Physics2D.Linecast(startPosition.Value, endPosition.Value, layerMask) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + startPosition = Vector2.zero; + endPosition = Vector2.zero; + layerMask = -1; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Linecast.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Linecast.cs.meta new file mode 100644 index 000000000..b0da266bd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Linecast.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a402dbfe872764f49b3a03d7048e866e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Linecast.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Raycast.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Raycast.cs new file mode 100644 index 000000000..7bc62c81a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Raycast.cs @@ -0,0 +1,69 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPhysics2D +{ + [TaskCategory("Unity/Physics2D")] + [TaskDescription("Casts a ray against all colliders in the scene. Returns success if a collider was hit.")] + public class Raycast : Action + { + [Tooltip("Starts the ray at the GameObject's position. If null the originPosition will be used.")] + public SharedGameObject originGameObject; + [Tooltip("Starts the ray at the position. Only used if originGameObject is null.")] + public SharedVector2 originPosition; + [Tooltip("The direction of the ray")] + public SharedVector2 direction; + [Tooltip("The length of the ray. Set to -1 for infinity.")] + public SharedFloat distance = -1; + [Tooltip("Selectively ignore colliders.")] + public LayerMask layerMask = -1; + [Tooltip("Cast the ray in world or local space. The direction is in world space if no GameObject is specified.")] + public Space space = Space.Self; + + [SharedRequired] + [Tooltip("Stores the hit object of the raycast.")] + public SharedGameObject storeHitObject; + [SharedRequired] + [Tooltip("Stores the hit point of the raycast.")] + public SharedVector2 storeHitPoint; + [SharedRequired] + [Tooltip("Stores the hit normal of the raycast.")] + public SharedVector2 storeHitNormal; + [SharedRequired] + [Tooltip("Stores the hit distance of the raycast.")] + public SharedFloat storeHitDistance; + + public override TaskStatus OnUpdate() + { + Vector2 position; + Vector2 dir = direction.Value; + if (originGameObject.Value != null) { + position = originGameObject.Value.transform.position; + if (space == Space.Self) { + dir = originGameObject.Value.transform.TransformDirection(direction.Value); + } + } else { + position = originPosition.Value; + } + + var hit = Physics2D.Raycast(position, dir, distance.Value == -1 ? Mathf.Infinity : distance.Value, layerMask); + if (hit.collider != null) { + storeHitObject.Value = hit.collider.gameObject; + storeHitPoint.Value = hit.point; + storeHitNormal.Value = hit.normal; + storeHitDistance.Value = hit.distance; + return TaskStatus.Success; + } + return TaskStatus.Failure; + } + + public override void OnReset() + { + originGameObject = null; + originPosition = Vector2.zero; + direction = Vector2.zero; + distance = -1; + layerMask = -1; + space = Space.Self; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Raycast.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Raycast.cs.meta new file mode 100644 index 000000000..d6e509c80 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Raycast.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 513dc641bb68bcc4d9c3bdfb1ccc57b6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Physics2D/Raycast.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs.meta new file mode 100644 index 000000000..a55270885 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: ae97053a4ac34f74d8edc5c635b28bda +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/DeleteAll.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/DeleteAll.cs new file mode 100644 index 000000000..256032624 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/DeleteAll.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPlayerPrefs +{ + [TaskCategory("Unity/PlayerPrefs")] + [TaskDescription("Deletes all entries from the PlayerPrefs.")] + public class DeleteAll : Action + { + public override TaskStatus OnUpdate() + { + PlayerPrefs.DeleteAll(); + + return TaskStatus.Success; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/DeleteAll.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/DeleteAll.cs.meta new file mode 100644 index 000000000..393bf9e65 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/DeleteAll.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 0c6d6b2dabc08ac42875cdbe1f86642b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/DeleteAll.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/DeleteKey.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/DeleteKey.cs new file mode 100644 index 000000000..bad8eb958 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/DeleteKey.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPlayerPrefs +{ + [TaskCategory("Unity/PlayerPrefs")] + [TaskDescription("Deletes the specified key from the PlayerPrefs.")] + public class DeleteKey : Action + { + [Tooltip("The key to delete")] + public SharedString key; + + public override TaskStatus OnUpdate() + { + PlayerPrefs.DeleteKey(key.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + key = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/DeleteKey.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/DeleteKey.cs.meta new file mode 100644 index 000000000..fa4590e74 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/DeleteKey.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ed24098bd046f724e90474d47e1677d3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/DeleteKey.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetFloat.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetFloat.cs new file mode 100644 index 000000000..e9c808c44 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetFloat.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPlayerPrefs +{ + [TaskCategory("Unity/PlayerPrefs")] + [TaskDescription("Stores the value with the specified key from the PlayerPrefs.")] + public class GetFloat : Action + { + [Tooltip("The key to store")] + public SharedString key; + [Tooltip("The default value")] + public SharedFloat defaultValue; + [Tooltip("The value retrieved from the PlayerPrefs")] + [RequiredField] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = PlayerPrefs.GetFloat(key.Value, defaultValue.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + key = ""; + defaultValue = 0; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetFloat.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetFloat.cs.meta new file mode 100644 index 000000000..c2de7612f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetFloat.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 14752e1987d17d546838a32459045c67 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetFloat.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetInt.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetInt.cs new file mode 100644 index 000000000..f5ec055e4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetInt.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPlayerPrefs +{ + [TaskCategory("Unity/PlayerPrefs")] + [TaskDescription("Stores the value with the specified key from the PlayerPrefs.")] + public class GetInt : Action + { + [Tooltip("The key to store")] + public SharedString key; + [Tooltip("The default value")] + public SharedInt defaultValue; + [Tooltip("The value retrieved from the PlayerPrefs")] + [RequiredField] + public SharedInt storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = PlayerPrefs.GetInt(key.Value, defaultValue.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + key = ""; + defaultValue = 0; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetInt.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetInt.cs.meta new file mode 100644 index 000000000..c27265efe --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetInt.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 66c5c9cfd0fb52344875db0cefc5d6f8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetInt.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetString.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetString.cs new file mode 100644 index 000000000..cc38b813d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetString.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPlayerPrefs +{ + [TaskCategory("Unity/PlayerPrefs")] + [TaskDescription("Stores the value with the specified key from the PlayerPrefs.")] + public class GetString : Action + { + [Tooltip("The key to store")] + public SharedString key; + [Tooltip("The default value")] + public SharedString defaultValue; + [Tooltip("The value retrieved from the PlayerPrefs")] + [RequiredField] + public SharedString storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = PlayerPrefs.GetString(key.Value, defaultValue.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + key = ""; + defaultValue = ""; + storeResult = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetString.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetString.cs.meta new file mode 100644 index 000000000..4df38f45a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetString.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 418066da4d19f1742a6435c0ee7aa01b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/GetString.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/HasKey.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/HasKey.cs new file mode 100644 index 000000000..08c2951ab --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/HasKey.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPlayerPrefs +{ + [TaskCategory("Unity/PlayerPrefs")] + [TaskDescription("Retruns success if the specified key exists.")] + public class HasKey : Conditional + { + [Tooltip("The key to check")] + public SharedString key; + + public override TaskStatus OnUpdate() + { + return PlayerPrefs.HasKey(key.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + key = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/HasKey.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/HasKey.cs.meta new file mode 100644 index 000000000..59458ec55 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/HasKey.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3b16fab74ec9f364f911696814716ca2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/HasKey.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/Save.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/Save.cs new file mode 100644 index 000000000..e5e2c5339 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/Save.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPlayerPrefs +{ + [TaskCategory("Unity/PlayerPrefs")] + [TaskDescription("Saves the PlayerPrefs.")] + public class Save : Action + { + public override TaskStatus OnUpdate() + { + PlayerPrefs.Save(); + + return TaskStatus.Success; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/Save.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/Save.cs.meta new file mode 100644 index 000000000..a3099b4e5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/Save.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 898765f1bc90e154e9cab895a814221e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/Save.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetFloat.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetFloat.cs new file mode 100644 index 000000000..399808386 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetFloat.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPlayerPrefs +{ + [TaskCategory("Unity/PlayerPrefs")] + [TaskDescription("Sets the value with the specified key from the PlayerPrefs.")] + public class SetFloat : Action + { + [Tooltip("The key to store")] + public SharedString key; + [Tooltip("The value to set")] + public SharedFloat value; + + public override TaskStatus OnUpdate() + { + PlayerPrefs.SetFloat(key.Value, value.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + key = ""; + value = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetFloat.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetFloat.cs.meta new file mode 100644 index 000000000..7e7257ba0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetFloat.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 88feec854545b9b428ed714fbebe872f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetFloat.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetInt.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetInt.cs new file mode 100644 index 000000000..d67afee58 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetInt.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPlayerPrefs +{ + [TaskCategory("Unity/PlayerPrefs")] + [TaskDescription("Sets the value with the specified key from the PlayerPrefs.")] + public class SetInt : Action + { + [Tooltip("The key to store")] + public SharedString key; + [Tooltip("The value to set")] + public SharedInt value; + + public override TaskStatus OnUpdate() + { + PlayerPrefs.SetInt(key.Value, value.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + key = ""; + value = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetInt.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetInt.cs.meta new file mode 100644 index 000000000..7902c6e21 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetInt.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ad23859aa9f9e68468891ba9600b9828 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetInt.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetString.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetString.cs new file mode 100644 index 000000000..6a9c0e661 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetString.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityPlayerPrefs +{ + [TaskCategory("Unity/PlayerPrefs")] + [TaskDescription("Sets the value with the specified key from the PlayerPrefs.")] + public class SetString : Action + { + [Tooltip("The key to store")] + public SharedString key; + [Tooltip("The value to set")] + public SharedString value; + + public override TaskStatus OnUpdate() + { + PlayerPrefs.SetString(key.Value, value.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + key = ""; + value = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetString.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetString.cs.meta new file mode 100644 index 000000000..392694768 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetString.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 923ae6162a2661e47be9af80a19e48b6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/PlayerPrefs/SetString.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion.meta new file mode 100644 index 000000000..de31e0f5d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: fdfca1ec6223a5644919a38e092a933c +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Angle.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Angle.cs new file mode 100644 index 000000000..5bd74f49a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Angle.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityQuaternion +{ + [TaskCategory("Unity/Quaternion")] + [TaskDescription("Stores the angle in degrees between two rotations.")] + public class Angle : Action + { + [Tooltip("The first rotation")] + public SharedQuaternion firstRotation; + [Tooltip("The second rotation")] + public SharedQuaternion secondRotation; + [Tooltip("The stored result")] + [RequiredField] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Quaternion.Angle(firstRotation.Value, secondRotation.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + firstRotation = secondRotation = Quaternion.identity; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Angle.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Angle.cs.meta new file mode 100644 index 000000000..2bc572ebe --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Angle.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 0d316a25dcddd6f4a981df05a1eeaf7c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Angle.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/AngleAxis.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/AngleAxis.cs new file mode 100644 index 000000000..62b55b0b2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/AngleAxis.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityQuaternion +{ + [TaskCategory("Unity/Quaternion")] + [TaskDescription("Stores the rotation which rotates the specified degrees around the specified axis.")] + public class AngleAxis : Action + { + [Tooltip("The number of degrees")] + public SharedFloat degrees; + [Tooltip("The axis direction")] + public SharedVector3 axis; + [Tooltip("The stored result")] + [RequiredField] + public SharedQuaternion storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Quaternion.AngleAxis(degrees.Value, axis.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + degrees = 0; + axis = Vector3.zero; + storeResult = Quaternion.identity; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/AngleAxis.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/AngleAxis.cs.meta new file mode 100644 index 000000000..d6ed0386e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/AngleAxis.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 82152b844829f8f43ab44f35bf7d786f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/AngleAxis.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Dot.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Dot.cs new file mode 100644 index 000000000..d022ef925 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Dot.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityQuaternion +{ + [TaskCategory("Unity/Quaternion")] + [TaskDescription("Stores the dot product between two rotations.")] + public class Dot : Action + { + [Tooltip("The first rotation")] + public SharedQuaternion leftRotation; + [Tooltip("The second rotation")] + public SharedQuaternion rightRotation; + [Tooltip("The stored result")] + [RequiredField] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Quaternion.Dot(leftRotation.Value, rightRotation.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + leftRotation = rightRotation = Quaternion.identity; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Dot.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Dot.cs.meta new file mode 100644 index 000000000..98bdbd255 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Dot.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fa9235523569d574aa7d22ce89423eca +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Dot.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Euler.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Euler.cs new file mode 100644 index 000000000..2462a1192 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Euler.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityQuaternion +{ + [TaskCategory("Unity/Quaternion")] + [TaskDescription("Stores the quaternion of a euler vector.")] + public class Euler : Action + { + [Tooltip("The euler vector")] + public SharedVector3 eulerVector; + [Tooltip("The stored quaternion")] + [RequiredField] + public SharedQuaternion storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Quaternion.Euler(eulerVector.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + eulerVector = Vector3.zero; + storeResult = Quaternion.identity; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Euler.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Euler.cs.meta new file mode 100644 index 000000000..056a81b7e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Euler.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b4d275b4450a324409ace385a718d9ee +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Euler.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/FromToRotation.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/FromToRotation.cs new file mode 100644 index 000000000..b1aeb95ae --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/FromToRotation.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityQuaternion +{ + [TaskCategory("Unity/Quaternion")] + [TaskDescription("Stores a rotation which rotates from the first direction to the second.")] + public class FromToRotation : Action + { + [Tooltip("The from rotation")] + public SharedVector3 fromDirection; + [Tooltip("The to rotation")] + public SharedVector3 toDirection; + [Tooltip("The stored result")] + [RequiredField] + public SharedQuaternion storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Quaternion.FromToRotation(fromDirection.Value, toDirection.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + fromDirection = toDirection = Vector3.zero; + storeResult = Quaternion.identity; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/FromToRotation.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/FromToRotation.cs.meta new file mode 100644 index 000000000..1a10df134 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/FromToRotation.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 56740b2c218d500408dd75c6c15006ec +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/FromToRotation.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Identity.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Identity.cs new file mode 100644 index 000000000..47099847d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Identity.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityQuaternion +{ + [TaskCategory("Unity/Quaternion")] + [TaskDescription("Stores the quaternion identity.")] + public class Identity : Action + { + [Tooltip("The identity")] + [RequiredField] + public SharedQuaternion storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Quaternion.identity; + return TaskStatus.Success; + } + + public override void OnReset() + { + storeResult = Quaternion.identity; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Identity.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Identity.cs.meta new file mode 100644 index 000000000..75cdb4fae --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Identity.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f4eefb6e25898904688a422ca79d763c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Identity.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Inverse.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Inverse.cs new file mode 100644 index 000000000..d4d42abbd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Inverse.cs @@ -0,0 +1,26 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityQuaternion +{ + [TaskCategory("Unity/Quaternion")] + [TaskDescription("Stores the inverse of the specified quaternion.")] + public class Inverse : Action + { + [Tooltip("The target quaternion")] + public SharedQuaternion targetQuaternion; + [Tooltip("The stored quaternion")] + [RequiredField] + public SharedQuaternion storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Quaternion.Inverse(targetQuaternion.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + targetQuaternion = storeResult = Quaternion.identity; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Inverse.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Inverse.cs.meta new file mode 100644 index 000000000..06b72d8f6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Inverse.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ab8f5048bc0e5ce409bf3408c60bc3eb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Inverse.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Lerp.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Lerp.cs new file mode 100644 index 000000000..826448b8b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Lerp.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityQuaternion +{ + [TaskCategory("Unity/Quaternion")] + [TaskDescription("Lerps between two quaternions.")] + public class Lerp : Action + { + [Tooltip("The from rotation")] + public SharedQuaternion fromQuaternion; + [Tooltip("The to rotation")] + public SharedQuaternion toQuaternion; + [Tooltip("The amount to lerp")] + public SharedFloat amount; + [Tooltip("The stored result")] + [RequiredField] + public SharedQuaternion storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Quaternion.Lerp(fromQuaternion.Value, toQuaternion.Value, amount.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + fromQuaternion = toQuaternion = storeResult = Quaternion.identity; + amount = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Lerp.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Lerp.cs.meta new file mode 100644 index 000000000..26a70c9e3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Lerp.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fb19d83a245337542a5c0f02593e8dab +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Lerp.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/LookRotation.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/LookRotation.cs new file mode 100644 index 000000000..698d553eb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/LookRotation.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityQuaternion +{ + [TaskCategory("Unity/Quaternion")] + [TaskDescription("Stores the quaternion of a forward vector.")] + public class LookRotation : Action + { + [Tooltip("The forward vector")] + public SharedVector3 forwardVector; + [Tooltip("The second Vector3")] + public SharedVector3 secondVector3 = Vector3.up; + [Tooltip("The stored quaternion")] + [RequiredField] + public SharedQuaternion storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Quaternion.LookRotation(forwardVector.Value, secondVector3.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + forwardVector = Vector3.zero; + storeResult = Quaternion.identity; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/LookRotation.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/LookRotation.cs.meta new file mode 100644 index 000000000..39d992ff0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/LookRotation.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e006fb91f87854448b9bd6cb1d20b2f1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/LookRotation.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/RotateTowards.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/RotateTowards.cs new file mode 100644 index 000000000..bbdfecfce --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/RotateTowards.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityQuaternion +{ + [TaskCategory("Unity/Quaternion")] + [TaskDescription("Stores the quaternion after a rotation.")] + public class RotateTowards : Action + { + [Tooltip("The from rotation")] + public SharedQuaternion fromQuaternion; + [Tooltip("The to rotation")] + public SharedQuaternion toQuaternion; + [Tooltip("The maximum degrees delta")] + public SharedFloat maxDeltaDegrees; + [Tooltip("The stored result")] + [RequiredField] + public SharedQuaternion storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Quaternion.RotateTowards(fromQuaternion.Value, toQuaternion.Value, maxDeltaDegrees.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + fromQuaternion = toQuaternion = storeResult = Quaternion.identity; + maxDeltaDegrees = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/RotateTowards.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/RotateTowards.cs.meta new file mode 100644 index 000000000..1f086f4fb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/RotateTowards.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b5e043a106ab4784aab997fa0e27f972 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/RotateTowards.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Slerp.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Slerp.cs new file mode 100644 index 000000000..0a4fb2062 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Slerp.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityQuaternion +{ + [TaskCategory("Unity/Quaternion")] + [TaskDescription("Spherically lerp between two quaternions.")] + public class Slerp : Action + { + [Tooltip("The from rotation")] + public SharedQuaternion fromQuaternion; + [Tooltip("The to rotation")] + public SharedQuaternion toQuaternion; + [Tooltip("The amount to lerp")] + public SharedFloat amount; + [Tooltip("The stored result")] + [RequiredField] + public SharedQuaternion storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Quaternion.Slerp(fromQuaternion.Value, toQuaternion.Value, amount.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + fromQuaternion = toQuaternion = storeResult = Quaternion.identity; + amount = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Slerp.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Slerp.cs.meta new file mode 100644 index 000000000..cbbc970c0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Slerp.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b36eacb0f1a46624193a622ef50979ff +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Quaternion/Slerp.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer.meta new file mode 100644 index 000000000..6eedf10e9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: b7bee06bd6fde844784243b656f96db8 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer/IsVisible.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer/IsVisible.cs new file mode 100644 index 000000000..157b4f7d6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer/IsVisible.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRenderer +{ + [TaskCategory("Unity/Renderer")] + [TaskDescription("Returns Success if the Renderer is visible, otherwise Failure.")] + public class IsVisible : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + // cache the renderer component + private Renderer renderer; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + renderer = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (renderer == null) { + Debug.LogWarning("Renderer is null"); + return TaskStatus.Failure; + } + + return renderer.isVisible ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer/IsVisible.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer/IsVisible.cs.meta new file mode 100644 index 000000000..dccef5bb5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer/IsVisible.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3b6ba7f7e8884c14c9ef4a74b50b0a8e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer/IsVisible.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer/SetMaterial.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer/SetMaterial.cs new file mode 100644 index 000000000..a8da2abdf --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer/SetMaterial.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRenderer +{ + [TaskCategory("Unity/Renderer")] + [TaskDescription("Sets the material on the Renderer.")] + public class SetMaterial : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The material to set")] + public SharedMaterial material; + + // cache the renderer component + private Renderer renderer; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + renderer = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (renderer == null) { + Debug.LogWarning("Renderer is null"); + return TaskStatus.Failure; + } + + renderer.material = material.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + material = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer/SetMaterial.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer/SetMaterial.cs.meta new file mode 100644 index 000000000..a885672bb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer/SetMaterial.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: bf71e4b9292cad342877356107f76d39 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Renderer/SetMaterial.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody.meta new file mode 100644 index 000000000..cfa304f01 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: f560fb42f946dcb4a819c0cca91d9c9d +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddExplosionForce.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddExplosionForce.cs new file mode 100644 index 000000000..3ee43276c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddExplosionForce.cs @@ -0,0 +1,57 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Applies a force to the rigidbody that simulates explosion effects. Returns Success.")] + public class AddExplosionForce : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The force of the explosion")] + public SharedFloat explosionForce; + [Tooltip("The position of the explosion")] + public SharedVector3 explosionPosition; + [Tooltip("The radius of the explosion")] + public SharedFloat explosionRadius; + [Tooltip("Applies the force as if it was applied from beneath the object")] + public float upwardsModifier = 0; + [Tooltip("The type of force")] + public ForceMode forceMode = ForceMode.Force; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.AddExplosionForce(explosionForce.Value, explosionPosition.Value, explosionRadius.Value, upwardsModifier, forceMode); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + explosionForce = 0; + explosionPosition = Vector3.zero; + explosionRadius = 0; + upwardsModifier = 0; + forceMode = ForceMode.Force; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddExplosionForce.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddExplosionForce.cs.meta new file mode 100644 index 000000000..9aa641352 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddExplosionForce.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ccb592e850d4c734995a2a1c3f930b62 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddExplosionForce.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddForce.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddForce.cs new file mode 100644 index 000000000..32ef6e8ad --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddForce.cs @@ -0,0 +1,51 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [RequiredComponent(typeof(Rigidbody))] + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Applies a force to the rigidbody. Returns Success.")] + public class AddForce : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The amount of force to apply")] + public SharedVector3 force; + [Tooltip("The type of force")] + public ForceMode forceMode = ForceMode.Force; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.AddForce(force.Value, forceMode); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + if (force != null) { + force.Value = Vector3.zero; + } + forceMode = ForceMode.Force; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddForce.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddForce.cs.meta new file mode 100644 index 000000000..34941f223 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddForce.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5748d4214b99b8c49ba67902a8495a30 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddForce.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddForceAtPosition.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddForceAtPosition.cs new file mode 100644 index 000000000..cefd11283 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddForceAtPosition.cs @@ -0,0 +1,51 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Applies a force at the specified position to the rigidbody. Returns Success.")] + public class AddForceAtPosition : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The amount of force to apply")] + public SharedVector3 force; + [Tooltip("The position of the force")] + public SharedVector3 position; + [Tooltip("The type of force")] + public ForceMode forceMode = ForceMode.Force; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.AddForceAtPosition(force.Value, position.Value, forceMode); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + force = Vector3.zero; + position = Vector3.zero; + forceMode = ForceMode.Force; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddForceAtPosition.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddForceAtPosition.cs.meta new file mode 100644 index 000000000..584243ad9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddForceAtPosition.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c3938bcd4e88b45419aa86adee51a2c2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddForceAtPosition.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddRelativeForce.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddRelativeForce.cs new file mode 100644 index 000000000..46a04a60f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddRelativeForce.cs @@ -0,0 +1,48 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Applies a force to the rigidbody relative to its coordinate system. Returns Success.")] + public class AddRelativeForce : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The amount of force to apply")] + public SharedVector3 force; + [Tooltip("The type of force")] + public ForceMode forceMode = ForceMode.Force; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.AddRelativeForce(force.Value, forceMode); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + force = Vector3.zero; + forceMode = ForceMode.Force; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddRelativeForce.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddRelativeForce.cs.meta new file mode 100644 index 000000000..42ec0913f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddRelativeForce.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1de05a2b6197b2d4b9da1c36bf382649 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddRelativeForce.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddRelativeTorque.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddRelativeTorque.cs new file mode 100644 index 000000000..58f4cb3f9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddRelativeTorque.cs @@ -0,0 +1,43 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Applies a torque to the rigidbody relative to its coordinate system. Returns Success.")] + public class AddRelativeTorque : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The amount of torque to apply")] + public SharedVector3 torque; + [Tooltip("The type of torque")] + public ForceMode forceMode = ForceMode.Force; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + rigidbody.AddRelativeTorque(torque.Value, forceMode); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + torque = Vector3.zero; + forceMode = ForceMode.Force; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddRelativeTorque.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddRelativeTorque.cs.meta new file mode 100644 index 000000000..e4414941c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddRelativeTorque.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 71136c1193309b24c93d450b5f2e47be +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddRelativeTorque.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddTorque.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddTorque.cs new file mode 100644 index 000000000..f0ee46b8f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddTorque.cs @@ -0,0 +1,48 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Applies a torque to the rigidbody. Returns Success.")] + public class AddTorque : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The amount of torque to apply")] + public SharedVector3 torque; + [Tooltip("The type of torque")] + public ForceMode forceMode = ForceMode.Force; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.AddTorque(torque.Value, forceMode); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + torque = Vector3.zero; + forceMode = ForceMode.Force; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddTorque.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddTorque.cs.meta new file mode 100644 index 000000000..8f549dd47 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddTorque.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 88c726c1cb324e6429637f55d36c3d01 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/AddTorque.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetAngularDrag.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetAngularDrag.cs new file mode 100644 index 000000000..32ed160d2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetAngularDrag.cs @@ -0,0 +1,46 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Stores the angular drag of the Rigidbody. Returns Success.")] + public class GetAngularDrag : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The angular drag of the Rigidbody")] + [RequiredField] + public SharedFloat storeValue; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody.angularDrag; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetAngularDrag.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetAngularDrag.cs.meta new file mode 100644 index 000000000..efb47c81d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetAngularDrag.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5fb34b334a02db64db2d6a2fb2448be5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetAngularDrag.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetAngularVelocity.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetAngularVelocity.cs new file mode 100644 index 000000000..efe250544 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetAngularVelocity.cs @@ -0,0 +1,46 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Stores the angular velocity of the Rigidbody. Returns Success.")] + public class GetAngularVelocity : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The angular velocity of the Rigidbody")] + [RequiredField] + public SharedVector3 storeValue; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody.angularVelocity; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetAngularVelocity.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetAngularVelocity.cs.meta new file mode 100644 index 000000000..c1ce17bab --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetAngularVelocity.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 492dc3a13d07ed149bcd19d36e2f7ee7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetAngularVelocity.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetCenterOfMass.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetCenterOfMass.cs new file mode 100644 index 000000000..3fa69fdff --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetCenterOfMass.cs @@ -0,0 +1,46 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Stores the center of mass of the Rigidbody. Returns Success.")] + public class GetCenterOfMass : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The center of mass of the Rigidbody")] + [RequiredField] + public SharedVector3 storeValue; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody.centerOfMass; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetCenterOfMass.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetCenterOfMass.cs.meta new file mode 100644 index 000000000..254791474 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetCenterOfMass.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b993020e1d60f5242a7e3618501f871e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetCenterOfMass.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetDrag.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetDrag.cs new file mode 100644 index 000000000..e5be30b49 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetDrag.cs @@ -0,0 +1,46 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Stores the drag of the Rigidbody. Returns Success.")] + public class GetDrag : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The drag of the Rigidbody")] + [RequiredField] + public SharedFloat storeValue; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody.drag; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetDrag.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetDrag.cs.meta new file mode 100644 index 000000000..54ce1bc42 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetDrag.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 69bd087f6899c604f82441b108ead2a8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetDrag.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetFreezeRotation.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetFreezeRotation.cs new file mode 100644 index 000000000..8deef57d1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetFreezeRotation.cs @@ -0,0 +1,46 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Stores the freeze rotation value of the Rigidbody. Returns Success.")] + public class GetFreezeRotation : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The freeze rotation value of the Rigidbody")] + [RequiredField] + public SharedBool storeValue; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody.freezeRotation; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetFreezeRotation.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetFreezeRotation.cs.meta new file mode 100644 index 000000000..fc15af108 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetFreezeRotation.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 889065cfad95df04a802761fcccb8359 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetFreezeRotation.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetIsKinematic.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetIsKinematic.cs new file mode 100644 index 000000000..36454f27e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetIsKinematic.cs @@ -0,0 +1,46 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Stores the is kinematic value of the Rigidbody. Returns Success.")] + public class GetIsKinematic : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The is kinematic value of the Rigidbody")] + [RequiredField] + public SharedBool storeValue; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody.isKinematic; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetIsKinematic.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetIsKinematic.cs.meta new file mode 100644 index 000000000..1c7243806 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetIsKinematic.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a531151d14b8a9640be8d499d9db4538 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetIsKinematic.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetMass.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetMass.cs new file mode 100644 index 000000000..f13f0fb3b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetMass.cs @@ -0,0 +1,46 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Stores the mass of the Rigidbody. Returns Success.")] + public class GetMass : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The mass of the Rigidbody")] + [RequiredField] + public SharedFloat storeValue; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody.mass; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetMass.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetMass.cs.meta new file mode 100644 index 000000000..18c552d24 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetMass.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2638ca749ba5a404f84fd72811b16c81 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetMass.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetPosition.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetPosition.cs new file mode 100644 index 000000000..908746a38 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetPosition.cs @@ -0,0 +1,46 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Stores the position of the Rigidbody. Returns Success.")] + public class GetPosition : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The position of the Rigidbody")] + [RequiredField] + public SharedVector3 storeValue; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody.position; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetPosition.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetPosition.cs.meta new file mode 100644 index 000000000..f9d6a2b84 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetPosition.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 25f9090c180831b4daaa1a24894681ac +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetPosition.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetRotation.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetRotation.cs new file mode 100644 index 000000000..6dcac3ed4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetRotation.cs @@ -0,0 +1,46 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Stores the rotation of the Rigidbody. Returns Success.")] + public class GetRotation : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The rotation of the Rigidbody")] + [RequiredField] + public SharedQuaternion storeValue; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody.rotation; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Quaternion.identity; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetRotation.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetRotation.cs.meta new file mode 100644 index 000000000..96fe998e8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetRotation.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 937400bc82220b543aa9b3074f17f4d6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetRotation.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetUseGravity.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetUseGravity.cs new file mode 100644 index 000000000..b7cdfda3d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetUseGravity.cs @@ -0,0 +1,46 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Stores the use gravity value of the Rigidbody. Returns Success.")] + public class GetUseGravity : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The use gravity value of the Rigidbody")] + [RequiredField] + public SharedBool storeValue; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody.useGravity; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetUseGravity.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetUseGravity.cs.meta new file mode 100644 index 000000000..c0d6f8281 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetUseGravity.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1d7358afc7810ca4aa2ae8a2cd4b9e6e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetUseGravity.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetVelocity.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetVelocity.cs new file mode 100644 index 000000000..fe7955447 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetVelocity.cs @@ -0,0 +1,46 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Stores the velocity of the Rigidbody. Returns Success.")] + public class GetVelocity : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The velocity of the Rigidbody")] + [RequiredField] + public SharedVector3 storeValue; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody.velocity; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetVelocity.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetVelocity.cs.meta new file mode 100644 index 000000000..8c217274e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetVelocity.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9c18365eb6865164ebb5b0057dcc6bb4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/GetVelocity.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/IsKinematic.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/IsKinematic.cs new file mode 100644 index 000000000..9273777a6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/IsKinematic.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Returns Success if the Rigidbody is kinematic, otherwise Failure.")] + public class IsKinematic : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + return rigidbody.isKinematic ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/IsKinematic.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/IsKinematic.cs.meta new file mode 100644 index 000000000..d9d4c1297 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/IsKinematic.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 30be28b36412643418c2e61640147eac +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/IsKinematic.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/IsSleeping.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/IsSleeping.cs new file mode 100644 index 000000000..286fe39fd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/IsSleeping.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Returns Success if the Rigidbody is sleeping, otherwise Failure.")] + public class IsSleeping : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + return rigidbody.IsSleeping() ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/IsSleeping.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/IsSleeping.cs.meta new file mode 100644 index 000000000..5ac996ff5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/IsSleeping.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 37e8153613f519240a11c3f6583d1030 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/IsSleeping.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/MovePosition.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/MovePosition.cs new file mode 100644 index 000000000..f7506b47b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/MovePosition.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Moves the Rigidbody to the specified position. Returns Success.")] + public class MovePosition : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The new position of the Rigidbody")] + public SharedVector3 position; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.MovePosition(position.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + position = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/MovePosition.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/MovePosition.cs.meta new file mode 100644 index 000000000..7fe028be3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/MovePosition.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 87176662744aee049b8af51b01bcb526 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/MovePosition.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/MoveRotation.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/MoveRotation.cs new file mode 100644 index 000000000..ea87fdba4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/MoveRotation.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Rotates the Rigidbody to the specified rotation. Returns Success.")] + public class MoveRotation : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The new rotation of the Rigidbody")] + public SharedQuaternion rotation; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.MoveRotation(rotation.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + rotation = Quaternion.identity; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/MoveRotation.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/MoveRotation.cs.meta new file mode 100644 index 000000000..d51b7ed84 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/MoveRotation.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f1ba2e66d5ca98a4ba4020b4eff4da6e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/MoveRotation.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetAngularDrag.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetAngularDrag.cs new file mode 100644 index 000000000..724da631e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetAngularDrag.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Sets the angular drag of the Rigidbody. Returns Success.")] + public class SetAngularDrag : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The angular drag of the Rigidbody")] + public SharedFloat angularDrag; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.angularDrag = angularDrag.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + angularDrag = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetAngularDrag.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetAngularDrag.cs.meta new file mode 100644 index 000000000..fb2f57f4b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetAngularDrag.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2883595af7ee1c649ae45353482beed8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetAngularDrag.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetAngularVelocity.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetAngularVelocity.cs new file mode 100644 index 000000000..a0f1ac618 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetAngularVelocity.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Sets the angular velocity of the Rigidbody. Returns Success.")] + public class SetAngularVelocity : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The angular velocity of the Rigidbody")] + public SharedVector3 angularVelocity; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.angularVelocity = angularVelocity.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + angularVelocity = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetAngularVelocity.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetAngularVelocity.cs.meta new file mode 100644 index 000000000..355eff630 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetAngularVelocity.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8652396368a6dad4eb6e1259e680595c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetAngularVelocity.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetCenterOfMass.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetCenterOfMass.cs new file mode 100644 index 000000000..61dd56c2f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetCenterOfMass.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Sets the center of mass of the Rigidbody. Returns Success.")] + public class SetCenterOfMass : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The center of mass of the Rigidbody")] + public SharedVector3 centerOfMass; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.centerOfMass = centerOfMass.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + centerOfMass = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetCenterOfMass.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetCenterOfMass.cs.meta new file mode 100644 index 000000000..4c2d383ab --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetCenterOfMass.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 594f2d37fbfc0d545a0377cf63543f41 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetCenterOfMass.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetConstraints.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetConstraints.cs new file mode 100644 index 000000000..1b19dc9ba --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetConstraints.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Sets the constraints of the Rigidbody. Returns Success.")] + public class SetConstraints : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The constraints of the Rigidbody")] + public RigidbodyConstraints constraints = RigidbodyConstraints.None; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.constraints = constraints; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + constraints = RigidbodyConstraints.None; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetConstraints.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetConstraints.cs.meta new file mode 100644 index 000000000..40cd8e371 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetConstraints.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: dd098240974b0184ca8c66cb6e450753 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetConstraints.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetDrag.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetDrag.cs new file mode 100644 index 000000000..766c8116b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetDrag.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Sets the drag of the Rigidbody. Returns Success.")] + public class SetDrag : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The drag of the Rigidbody")] + public SharedFloat drag; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.drag = drag.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + drag = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetDrag.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetDrag.cs.meta new file mode 100644 index 000000000..54093d9d9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetDrag.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8984a684f33e6644abbb9cfe6c9068d9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetDrag.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetFreezeRotation.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetFreezeRotation.cs new file mode 100644 index 000000000..df97a2f77 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetFreezeRotation.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Sets the freeze rotation value of the Rigidbody. Returns Success.")] + public class SetFreezeRotation : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The freeze rotation value of the Rigidbody")] + public SharedBool freezeRotation; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.freezeRotation = freezeRotation.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + freezeRotation = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetFreezeRotation.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetFreezeRotation.cs.meta new file mode 100644 index 000000000..f752ca29e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetFreezeRotation.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4160755a1f5174546b6ccbabff469187 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetFreezeRotation.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetIsKinematic.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetIsKinematic.cs new file mode 100644 index 000000000..ec6f8525b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetIsKinematic.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Sets the is kinematic value of the Rigidbody. Returns Success.")] + public class SetIsKinematic : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The is kinematic value of the Rigidbody")] + public SharedBool isKinematic; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.isKinematic = isKinematic.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + isKinematic = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetIsKinematic.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetIsKinematic.cs.meta new file mode 100644 index 000000000..5067b935f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetIsKinematic.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6d93194d82815024cadf3f4f842666d0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetIsKinematic.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetMass.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetMass.cs new file mode 100644 index 000000000..8a823f0b9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetMass.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Sets the mass of the Rigidbody. Returns Success.")] + public class SetMass : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The mass of the Rigidbody")] + public SharedFloat mass; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.mass = mass.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + mass = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetMass.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetMass.cs.meta new file mode 100644 index 000000000..d465fc839 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetMass.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 82f7a92bee3553d49bbb1ebabfaffc12 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetMass.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetPosition.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetPosition.cs new file mode 100644 index 000000000..add8f6386 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetPosition.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Sets the position of the Rigidbody. Returns Success.")] + public class SetPosition : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The position of the Rigidbody")] + public SharedVector3 position; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.position = position.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + position = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetPosition.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetPosition.cs.meta new file mode 100644 index 000000000..416f77950 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetPosition.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8a33b86eb94a87c449e1f3344973cc50 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetPosition.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetRotation.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetRotation.cs new file mode 100644 index 000000000..24be3eca5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetRotation.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Stores the rotation of the Rigidbody. Returns Success.")] + public class SetRotation : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The rotation of the Rigidbody")] + public SharedQuaternion rotation; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.rotation = rotation.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + rotation = Quaternion.identity; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetRotation.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetRotation.cs.meta new file mode 100644 index 000000000..63b491edc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetRotation.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c5ac2e84278f4a845ba47d1e4469e869 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetRotation.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetUseGravity.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetUseGravity.cs new file mode 100644 index 000000000..0380dbf6b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetUseGravity.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Sets the use gravity value of the Rigidbody. Returns Success.")] + public class SetUseGravity : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The use gravity value of the Rigidbody")] + public SharedBool useGravity; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.useGravity = useGravity.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + useGravity = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetUseGravity.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetUseGravity.cs.meta new file mode 100644 index 000000000..91791c39c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetUseGravity.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 19548f438ad1c684180d41713cbdeb76 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetUseGravity.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetVelocity.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetVelocity.cs new file mode 100644 index 000000000..b57239eff --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetVelocity.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Sets the velocity of the Rigidbody. Returns Success.")] + public class SetVelocity : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The velocity of the Rigidbody")] + public SharedVector3 velocity; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.velocity = velocity.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + velocity = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetVelocity.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetVelocity.cs.meta new file mode 100644 index 000000000..cd4767a45 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetVelocity.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3e3fc3ca798c87644a42b1c930fff3f0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/SetVelocity.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/Sleep.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/Sleep.cs new file mode 100644 index 000000000..80ceee63a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/Sleep.cs @@ -0,0 +1,42 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Forces the Rigidbody to sleep at least one frame. Returns Success.")] + public class Sleep : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.Sleep(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/Sleep.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/Sleep.cs.meta new file mode 100644 index 000000000..2f168ebce --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/Sleep.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1683ca7168c4ce74db4396c4d3cb65ce +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/Sleep.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/UseGravity.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/UseGravity.cs new file mode 100644 index 000000000..6933c91d0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/UseGravity.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Returns Success if the Rigidbody is using gravity, otherwise Failure.")] + public class UseGravity : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + return rigidbody.useGravity ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/UseGravity.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/UseGravity.cs.meta new file mode 100644 index 000000000..be7283725 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/UseGravity.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a0d11b67c4ae058469e7f7b00db7103f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/UseGravity.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/WakeUp.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/WakeUp.cs new file mode 100644 index 000000000..b699040d6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/WakeUp.cs @@ -0,0 +1,42 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody +{ + [TaskCategory("Unity/Rigidbody")] + [TaskDescription("Forces the Rigidbody to wake up. Returns Success.")] + public class WakeUp : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + // cache the rigidbody component + private Rigidbody rigidbody; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody.WakeUp(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/WakeUp.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/WakeUp.cs.meta new file mode 100644 index 000000000..0d1e24d74 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/WakeUp.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d4314af88b4d86046bdac1f10f6f9a47 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody/WakeUp.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D.meta new file mode 100644 index 000000000..84e1cee7b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 842427c186c2e5941b1b02873f6480e3 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddForce.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddForce.cs new file mode 100644 index 000000000..86e2d3e06 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddForce.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Applies a force to the Rigidbody2D. Returns Success.")] + public class AddForce : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The amount of force to apply")] + public SharedVector2 force; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + rigidbody2D.AddForce(force.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + force = Vector2.zero; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddForce.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddForce.cs.meta new file mode 100644 index 000000000..0fc3c450a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddForce.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9ea79154ee01cf441a9744c877542a1f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddForce.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddForceAtPosition.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddForceAtPosition.cs new file mode 100644 index 000000000..8d8be2f18 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddForceAtPosition.cs @@ -0,0 +1,47 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Applies a force at the specified position to the Rigidbody2D. Returns Success.")] + public class AddForceAtPosition : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The amount of force to apply")] + public SharedVector2 force; + [Tooltip("The position of the force")] + public SharedVector2 position; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + rigidbody2D.AddForceAtPosition(force.Value, position.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + force = Vector2.zero; + position = Vector2.zero; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddForceAtPosition.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddForceAtPosition.cs.meta new file mode 100644 index 000000000..3838e89dd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddForceAtPosition.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: dd82f0f77306bad46bae7944a5c66664 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddForceAtPosition.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddTorque.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddTorque.cs new file mode 100644 index 000000000..f214d95ed --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddTorque.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Applies a torque to the Rigidbody2D. Returns Success.")] + public class AddTorque : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The amount of torque to apply")] + public SharedFloat torque; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + rigidbody2D.AddTorque(torque.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + torque = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddTorque.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddTorque.cs.meta new file mode 100644 index 000000000..831475110 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddTorque.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: cc561d806d4518044becff628e148424 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/AddTorque.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetAngularDrag.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetAngularDrag.cs new file mode 100644 index 000000000..a3c812f56 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetAngularDrag.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Stores the angular drag of the Rigidbody2D. Returns Success.")] + public class GetAngularDrag : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The angular drag of the Rigidbody2D")] + [RequiredField] + public SharedFloat storeValue; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody2D.angularDrag; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetAngularDrag.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetAngularDrag.cs.meta new file mode 100644 index 000000000..33ece5bf0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetAngularDrag.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 10833270578d69041b561c5126bb31f2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetAngularDrag.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetAngularVelocity.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetAngularVelocity.cs new file mode 100644 index 000000000..d3edc1cd2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetAngularVelocity.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Stores the angular velocity of the Rigidbody2D. Returns Success.")] + public class GetAngularVelocity : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The angular velocity of the Rigidbody2D")] + [RequiredField] + public SharedFloat storeValue; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody2D.angularVelocity; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetAngularVelocity.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetAngularVelocity.cs.meta new file mode 100644 index 000000000..6fe33253a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetAngularVelocity.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 68ac62a9384c11245a850220f1bc72b8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetAngularVelocity.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetDrag.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetDrag.cs new file mode 100644 index 000000000..6cd09404c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetDrag.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Stores the drag of the Rigidbody2D. Returns Success.")] + public class GetDrag : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The drag of the Rigidbody2D")] + [RequiredField] + public SharedFloat storeValue; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody2D.drag; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetDrag.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetDrag.cs.meta new file mode 100644 index 000000000..a89faf3af --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetDrag.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6e39198e5d65d514185f2816cced7c7b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetDrag.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetGravtyScale.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetGravtyScale.cs new file mode 100644 index 000000000..41a2a7f78 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetGravtyScale.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Stores the gravity scale of the Rigidbody2D. Returns Success.")] + public class GetGravityScale : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The gravity scale of the Rigidbody2D")] + [RequiredField] + public SharedFloat storeValue; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody2D.gravityScale; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetGravtyScale.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetGravtyScale.cs.meta new file mode 100644 index 000000000..2f9f7d1f2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetGravtyScale.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e2d17fb9baea6554082f2edc46483e8c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetGravtyScale.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetIsKinematic.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetIsKinematic.cs new file mode 100644 index 000000000..d32b65e7d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetIsKinematic.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Stores the is kinematic value of the Rigidbody2D. Returns Success.")] + public class GetIsKinematic : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The is kinematic value of the Rigidbody2D")] + [RequiredField] + public SharedBool storeValue; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody2D.isKinematic; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = false; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetIsKinematic.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetIsKinematic.cs.meta new file mode 100644 index 000000000..9c9758333 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetIsKinematic.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 66c6175d42bd49e48be458378e0a7875 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetIsKinematic.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetMass.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetMass.cs new file mode 100644 index 000000000..f7faaee2f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetMass.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Stores the mass of the Rigidbody2D. Returns Success.")] + public class GetMass : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The mass of the Rigidbody2D")] + [RequiredField] + public SharedFloat storeValue; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody2D.mass; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetMass.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetMass.cs.meta new file mode 100644 index 000000000..114f97757 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetMass.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 72d52ef5efe5e974994c91279536555e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetMass.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetPosition.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetPosition.cs new file mode 100644 index 000000000..da0dd26ec --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetPosition.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Stores the position of the Rigidbody2D. Returns Success.")] + public class GetPosition : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The velocity of the Rigidbody2D")] + [RequiredField] + public SharedVector2 storeValue; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody2D.position; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector2.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetPosition.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetPosition.cs.meta new file mode 100644 index 000000000..53ecfca3a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetPosition.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 98dff23734f3a834cbf5ccf87c9904f7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetPosition.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetRotation.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetRotation.cs new file mode 100644 index 000000000..5b89ff372 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetRotation.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Stores the rotation of the Rigidbody2D. Returns Success.")] + public class GetRotation : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The rotation of the Rigidbody2D")] + [RequiredField] + public SharedFloat storeValue; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody2D.rotation; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetRotation.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetRotation.cs.meta new file mode 100644 index 000000000..ef4d0822e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetRotation.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a7d82ab7ef780f34cb5df06366b0bdbf +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetRotation.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetVelocity.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetVelocity.cs new file mode 100644 index 000000000..98b6b4eef --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetVelocity.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Stores the velocity of the Rigidbody2D. Returns Success.")] + public class GetVelocity : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The velocity of the Rigidbody2D")] + [RequiredField] + public SharedVector2 storeValue; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + storeValue.Value = rigidbody2D.velocity; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector2.zero; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetVelocity.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetVelocity.cs.meta new file mode 100644 index 000000000..1e08e8a79 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetVelocity.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 13009f7b6ee1bc04884442484a065cc3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/GetVelocity.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/IsKinematic.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/IsKinematic.cs new file mode 100644 index 000000000..7c7ecab13 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/IsKinematic.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Returns Success if the Rigidbody2D is kinematic, otherwise Failure.")] + public class IsKinematic : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + return rigidbody2D.isKinematic ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/IsKinematic.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/IsKinematic.cs.meta new file mode 100644 index 000000000..2c10e2dfd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/IsKinematic.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 47d2e6e60a2251c41a2c548dc9a8c922 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/IsKinematic.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/IsSleeping.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/IsSleeping.cs new file mode 100644 index 000000000..248a23e96 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/IsSleeping.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Returns Success if the Rigidbody2D is sleeping, otherwise Failure.")] + public class IsSleeping : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + return rigidbody2D.IsSleeping() ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/IsSleeping.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/IsSleeping.cs.meta new file mode 100644 index 000000000..1995267fa --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/IsSleeping.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 52859810158277a4a917e70a834a82a5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/IsSleeping.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/MovePosition.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/MovePosition.cs new file mode 100644 index 000000000..f77e34d5e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/MovePosition.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Moves the Rigidbody2D to the specified position. Returns Success.")] + public class MovePosition : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The new position of the Rigidbody")] + public SharedVector2 position; + + // cache the rigidbody component + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody2D.MovePosition(position.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + position = Vector2.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/MovePosition.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/MovePosition.cs.meta new file mode 100644 index 000000000..f44e79b2a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/MovePosition.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3e72fab171287194ea2d8eb2aa239cd4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/MovePosition.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/MoveRotation.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/MoveRotation.cs new file mode 100644 index 000000000..f55821f1c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/MoveRotation.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Rotates the Rigidbody2D to the specified rotation. Returns Success.")] + public class MoveRotation : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The new rotation of the Rigidbody")] + public SharedFloat rotation; + + // cache the rigidbody component + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody is null"); + return TaskStatus.Failure; + } + + rigidbody2D.MoveRotation(rotation.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + rotation = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/MoveRotation.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/MoveRotation.cs.meta new file mode 100644 index 000000000..91b9ef3a6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/MoveRotation.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 38b0095c420511f4b9ed263b1b5c6054 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/MoveRotation.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetAngularDrag.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetAngularDrag.cs new file mode 100644 index 000000000..1df126b0a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetAngularDrag.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Sets the angular drag of the Rigidbody2D. Returns Success.")] + public class SetAngularDrag : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The angular drag of the Rigidbody2D")] + public SharedFloat angularDrag; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + rigidbody2D.angularDrag = angularDrag.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + angularDrag = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetAngularDrag.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetAngularDrag.cs.meta new file mode 100644 index 000000000..9f738aec1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetAngularDrag.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1717a737318274e4caa244f86c908851 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetAngularDrag.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetAngularVelocity.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetAngularVelocity.cs new file mode 100644 index 000000000..ef1595f1f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetAngularVelocity.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Sets the angular velocity of the Rigidbody2D. Returns Success.")] + public class SetAngularVelocity : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The angular velocity of the Rigidbody2D")] + public SharedFloat angularVelocity; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + rigidbody2D.angularVelocity = angularVelocity.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + angularVelocity = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetAngularVelocity.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetAngularVelocity.cs.meta new file mode 100644 index 000000000..7a3e51f2a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetAngularVelocity.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c73dfb332d90cbe4280c21fafa59e2fa +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetAngularVelocity.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetDrag.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetDrag.cs new file mode 100644 index 000000000..77b462e97 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetDrag.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Sets the drag of the Rigidbody2D. Returns Success.")] + public class SetDrag : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The drag of the Rigidbody2D")] + public SharedFloat drag; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + rigidbody2D.drag = drag.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + drag = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetDrag.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetDrag.cs.meta new file mode 100644 index 000000000..0aaf92f01 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetDrag.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3148efd94c23d634a9f02cc9c808de80 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetDrag.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetGravityScale.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetGravityScale.cs new file mode 100644 index 000000000..85ebe613d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetGravityScale.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Sets the gravity scale of the Rigidbody2D. Returns Success.")] + public class SetGravityScale : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The gravity scale of the Rigidbody2D")] + public SharedFloat gravityScale; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + rigidbody2D.gravityScale = gravityScale.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + gravityScale = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetGravityScale.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetGravityScale.cs.meta new file mode 100644 index 000000000..3c76d3a24 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetGravityScale.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ac896135858701649bcaffc7ef00637f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetGravityScale.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetIsKinematic.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetIsKinematic.cs new file mode 100644 index 000000000..401f422ce --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetIsKinematic.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Sets the is kinematic value of the Rigidbody2D. Returns Success.")] + public class SetIsKinematic : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The is kinematic value of the Rigidbody2D")] + public SharedBool isKinematic; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + rigidbody2D.isKinematic = isKinematic.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + isKinematic = false; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetIsKinematic.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetIsKinematic.cs.meta new file mode 100644 index 000000000..b7cdb7205 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetIsKinematic.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b7c96d64d821e304a8c67c031565d902 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetIsKinematic.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetMass.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetMass.cs new file mode 100644 index 000000000..1042b6ddb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetMass.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Sets the mass of the Rigidbody2D. Returns Success.")] + public class SetMass : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The mass of the Rigidbody2D")] + public SharedFloat mass; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + rigidbody2D.mass = mass.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + mass = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetMass.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetMass.cs.meta new file mode 100644 index 000000000..e976c4ad0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetMass.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: facbfd14ece02214889d587f06215105 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetMass.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetVelocity.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetVelocity.cs new file mode 100644 index 000000000..7ea019c24 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetVelocity.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Sets the velocity of the Rigidbody2D. Returns Success.")] + public class SetVelocity : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The velocity of the Rigidbody2D")] + public SharedVector2 velocity; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + rigidbody2D.velocity = velocity.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + velocity = Vector2.zero; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetVelocity.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetVelocity.cs.meta new file mode 100644 index 000000000..ca4cbb6f7 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetVelocity.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5830960da4f9a3148ba5d8cd87228748 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/SetVelocity.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/Sleep.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/Sleep.cs new file mode 100644 index 000000000..345386f0a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/Sleep.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Forces the Rigidbody2D to sleep at least one frame. Returns Success.")] + public class Sleep : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + rigidbody2D.Sleep(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/Sleep.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/Sleep.cs.meta new file mode 100644 index 000000000..d95e7d33e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/Sleep.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7e24fd00ca72fda48a132dc9bfa71070 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/Sleep.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/WakeUp.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/WakeUp.cs new file mode 100644 index 000000000..dfe49106e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/WakeUp.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityRigidbody2D +{ + [TaskCategory("Unity/Rigidbody2D")] + [TaskDescription("Forces the Rigidbody2D to wake up. Returns Success.")] + public class WakeUp : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private Rigidbody2D rigidbody2D; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + rigidbody2D = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (rigidbody2D == null) { + Debug.LogWarning("Rigidbody2D is null"); + return TaskStatus.Failure; + } + + rigidbody2D.WakeUp(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/WakeUp.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/WakeUp.cs.meta new file mode 100644 index 000000000..e218ba9a6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/WakeUp.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 954f1f9c196c39345b2fd389516ad613 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Rigidbody2D/WakeUp.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables.meta new file mode 100644 index 000000000..33f2d8fbc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 1ca8022ad636ccc4ab940c05d58dfd6b +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedBool.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedBool.cs new file mode 100644 index 000000000..453f10afd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedBool.cs @@ -0,0 +1,23 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Returns success if the variable value is equal to the compareTo value.")] + public class CompareSharedBool : Conditional + { + [Tooltip("The first variable to compare")] + public SharedBool variable; + [Tooltip("The variable to compare to")] + public SharedBool compareTo; + + public override TaskStatus OnUpdate() + { + return variable.Value.Equals(compareTo.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + variable = false; + compareTo = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedBool.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedBool.cs.meta new file mode 100644 index 000000000..c3cabb921 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedBool.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ba0766a97c2e5c94fbc49d8cb1dea8e3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedBool.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedColor.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedColor.cs new file mode 100644 index 000000000..f37908f6e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedColor.cs @@ -0,0 +1,25 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Returns success if the variable value is equal to the compareTo value.")] + public class CompareSharedColor : Conditional + { + [Tooltip("The first variable to compare")] + public SharedColor variable; + [Tooltip("The variable to compare to")] + public SharedColor compareTo; + + public override TaskStatus OnUpdate() + { + return variable.Value.Equals(compareTo.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + variable = Color.black; + compareTo = Color.black; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedColor.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedColor.cs.meta new file mode 100644 index 000000000..c48c7bdc3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedColor.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c9e83747d98bd064b9a5ad62b36d7657 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedColor.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedFloat.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedFloat.cs new file mode 100644 index 000000000..3c58f8d44 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedFloat.cs @@ -0,0 +1,23 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Returns success if the variable value is equal to the compareTo value.")] + public class CompareSharedFloat : Conditional + { + [Tooltip("The first variable to compare")] + public SharedFloat variable; + [Tooltip("The variable to compare to")] + public SharedFloat compareTo; + + public override TaskStatus OnUpdate() + { + return variable.Value.Equals(compareTo.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + variable = 0; + compareTo = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedFloat.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedFloat.cs.meta new file mode 100644 index 000000000..0739d1144 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedFloat.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6925a99e92b6d804db1f4b607e7501d3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedFloat.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedGameObject.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedGameObject.cs new file mode 100644 index 000000000..8f550e379 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedGameObject.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Returns success if the variable value is equal to the compareTo value.")] + public class CompareSharedGameObject : Conditional + { + [Tooltip("The first variable to compare")] + public SharedGameObject variable; + [Tooltip("The variable to compare to")] + public SharedGameObject compareTo; + + public override TaskStatus OnUpdate() + { + if (variable.Value == null && compareTo.Value != null) + return TaskStatus.Failure; + if (variable.Value == null && compareTo.Value == null) + return TaskStatus.Success; + + return variable.Value.Equals(compareTo.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + variable = null; + compareTo = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedGameObject.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedGameObject.cs.meta new file mode 100644 index 000000000..c9a08d693 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedGameObject.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: daa5c3b8a325bcd4bb3da10a6715f6d0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedGameObject.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedGameObjectList.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedGameObjectList.cs new file mode 100644 index 000000000..0362e597b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedGameObjectList.cs @@ -0,0 +1,35 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Returns success if the variable value is equal to the compareTo value.")] + public class CompareSharedGameObjectList : Conditional + { + [Tooltip("The first variable to compare")] + public SharedGameObjectList variable; + [Tooltip("The variable to compare to")] + public SharedGameObjectList compareTo; + + public override TaskStatus OnUpdate() + { + if (variable.Value == null && compareTo.Value != null) + return TaskStatus.Failure; + if (variable.Value == null && compareTo.Value == null) + return TaskStatus.Success; + if (variable.Value.Count != compareTo.Value.Count) + return TaskStatus.Failure; + + for (int i = 0; i < variable.Value.Count; ++i) { + if (variable.Value[i] != compareTo.Value[i]) { + return TaskStatus.Failure; + } + } + return TaskStatus.Success; + } + + public override void OnReset() + { + variable = null; + compareTo = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedGameObjectList.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedGameObjectList.cs.meta new file mode 100644 index 000000000..993324073 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedGameObjectList.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a2b81932d36a0be4fba0868f7ed3e53c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedGameObjectList.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedInt.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedInt.cs new file mode 100644 index 000000000..ce216d9ba --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedInt.cs @@ -0,0 +1,23 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Returns success if the variable value is equal to the compareTo value.")] + public class CompareSharedInt : Conditional + { + [Tooltip("The first variable to compare")] + public SharedInt variable; + [Tooltip("The variable to compare to")] + public SharedInt compareTo; + + public override TaskStatus OnUpdate() + { + return variable.Value.Equals(compareTo.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + variable = 0; + compareTo = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedInt.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedInt.cs.meta new file mode 100644 index 000000000..190b7d48d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedInt.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 40307a4117777b4479a1402fd67811ff +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedInt.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedObject.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedObject.cs new file mode 100644 index 000000000..6ea4fedd3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedObject.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Returns success if the variable value is equal to the compareTo value.")] + public class CompareSharedObject : Conditional + { + [Tooltip("The first variable to compare")] + public SharedObject variable; + [Tooltip("The variable to compare to")] + public SharedObject compareTo; + + public override TaskStatus OnUpdate() + { + if (variable.Value == null && compareTo.Value != null) + return TaskStatus.Failure; + if (variable.Value == null && compareTo.Value == null) + return TaskStatus.Success; + + return variable.Value.Equals(compareTo.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + variable = null; + compareTo = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedObject.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedObject.cs.meta new file mode 100644 index 000000000..8c24050fc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedObject.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 66a9105498519ae4082d9ac7adcf5da4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedObject.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedObjectList.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedObjectList.cs new file mode 100644 index 000000000..be59a5846 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedObjectList.cs @@ -0,0 +1,35 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Returns success if the variable value is equal to the compareTo value.")] + public class CompareSharedObjectList : Conditional + { + [Tooltip("The first variable to compare")] + public SharedObjectList variable; + [Tooltip("The variable to compare to")] + public SharedObjectList compareTo; + + public override TaskStatus OnUpdate() + { + if (variable.Value == null && compareTo.Value != null) + return TaskStatus.Failure; + if (variable.Value == null && compareTo.Value == null) + return TaskStatus.Success; + if (variable.Value.Count != compareTo.Value.Count) + return TaskStatus.Failure; + + for (int i = 0; i < variable.Value.Count; ++i) { + if (variable.Value[i] != compareTo.Value[i]) { + return TaskStatus.Failure; + } + } + return TaskStatus.Success; + } + + public override void OnReset() + { + variable = null; + compareTo = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedObjectList.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedObjectList.cs.meta new file mode 100644 index 000000000..1af398fa1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedObjectList.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ac4cab9acc737904885d379388e83950 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedObjectList.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedQuaternion.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedQuaternion.cs new file mode 100644 index 000000000..9867ed545 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedQuaternion.cs @@ -0,0 +1,25 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Returns success if the variable value is equal to the compareTo value.")] + public class CompareSharedQuaternion : Conditional + { + [Tooltip("The first variable to compare")] + public SharedQuaternion variable; + [Tooltip("The variable to compare to")] + public SharedQuaternion compareTo; + + public override TaskStatus OnUpdate() + { + return variable.Value.Equals(compareTo.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + variable = Quaternion.identity; + compareTo = Quaternion.identity; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedQuaternion.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedQuaternion.cs.meta new file mode 100644 index 000000000..19643514e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedQuaternion.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 101b2ac215bf58149ab91be3b55d5145 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedQuaternion.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedRect.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedRect.cs new file mode 100644 index 000000000..92060a810 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedRect.cs @@ -0,0 +1,25 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Returns success if the variable value is equal to the compareTo value.")] + public class CompareSharedRect : Conditional + { + [Tooltip("The first variable to compare")] + public SharedRect variable; + [Tooltip("The variable to compare to")] + public SharedRect compareTo; + + public override TaskStatus OnUpdate() + { + return variable.Value.Equals(compareTo.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + variable = new Rect(); + compareTo = new Rect(); + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedRect.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedRect.cs.meta new file mode 100644 index 000000000..4144c130a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedRect.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d73d97622bbe61d4c91f9b4cacb3e0c2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedRect.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedString.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedString.cs new file mode 100644 index 000000000..2c566a529 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedString.cs @@ -0,0 +1,23 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Returns success if the variable value is equal to the compareTo value.")] + public class CompareSharedString : Conditional + { + [Tooltip("The first variable to compare")] + public SharedString variable; + [Tooltip("The variable to compare to")] + public SharedString compareTo; + + public override TaskStatus OnUpdate() + { + return variable.Value.Equals(compareTo.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + variable = ""; + compareTo = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedString.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedString.cs.meta new file mode 100644 index 000000000..791c2ead4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedString.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8b1a3248c84732345914404e47a55fcc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedString.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedTransform.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedTransform.cs new file mode 100644 index 000000000..6210a6d7e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedTransform.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Returns success if the variable value is equal to the compareTo value.")] + public class CompareSharedTransform : Conditional + { + [Tooltip("The first variable to compare")] + public SharedTransform variable; + [Tooltip("The variable to compare to")] + public SharedTransform compareTo; + + public override TaskStatus OnUpdate() + { + if (variable.Value == null && compareTo.Value != null) + return TaskStatus.Failure; + if (variable.Value == null && compareTo.Value == null) + return TaskStatus.Success; + + return variable.Value.Equals(compareTo.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + variable = null; + compareTo = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedTransform.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedTransform.cs.meta new file mode 100644 index 000000000..bac2bf6ea --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedTransform.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a21f70566ff2afc4e95454d3d658c1fa +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedTransform.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedTransformList.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedTransformList.cs new file mode 100644 index 000000000..16248c902 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedTransformList.cs @@ -0,0 +1,35 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Returns success if the variable value is equal to the compareTo value.")] + public class CompareSharedTransformList : Conditional + { + [Tooltip("The first variable to compare")] + public SharedTransformList variable; + [Tooltip("The variable to compare to")] + public SharedTransformList compareTo; + + public override TaskStatus OnUpdate() + { + if (variable.Value == null && compareTo.Value != null) + return TaskStatus.Failure; + if (variable.Value == null && compareTo.Value == null) + return TaskStatus.Success; + if (variable.Value.Count != compareTo.Value.Count) + return TaskStatus.Failure; + + for (int i = 0; i < variable.Value.Count; ++i) { + if (variable.Value[i] != compareTo.Value[i]) { + return TaskStatus.Failure; + } + } + return TaskStatus.Success; + } + + public override void OnReset() + { + variable = null; + compareTo = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedTransformList.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedTransformList.cs.meta new file mode 100644 index 000000000..090167939 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedTransformList.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8ea22243f4fc22946a0033142f3a2380 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedTransformList.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector2.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector2.cs new file mode 100644 index 000000000..72892c565 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector2.cs @@ -0,0 +1,25 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Returns success if the variable value is equal to the compareTo value.")] + public class CompareSharedVector2 : Conditional + { + [Tooltip("The first variable to compare")] + public SharedVector2 variable; + [Tooltip("The variable to compare to")] + public SharedVector2 compareTo; + + public override TaskStatus OnUpdate() + { + return variable.Value.Equals(compareTo.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + variable = Vector2.zero; + compareTo = Vector2.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector2.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector2.cs.meta new file mode 100644 index 000000000..d2e631ece --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector2.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ce90fa6ac7a64b044936fa647e5f0e80 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector2.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector3.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector3.cs new file mode 100644 index 000000000..0b9e6ada9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector3.cs @@ -0,0 +1,25 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Returns success if the variable value is equal to the compareTo value.")] + public class CompareSharedVector3 : Conditional + { + [Tooltip("The first variable to compare")] + public SharedVector3 variable; + [Tooltip("The variable to compare to")] + public SharedVector3 compareTo; + + public override TaskStatus OnUpdate() + { + return variable.Value.Equals(compareTo.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + variable = Vector3.zero; + compareTo = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector3.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector3.cs.meta new file mode 100644 index 000000000..56b1ad389 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector3.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 617192db87511d844940d400c960d13d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector3.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector4.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector4.cs new file mode 100644 index 000000000..8085c55d3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector4.cs @@ -0,0 +1,25 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Returns success if the variable value is equal to the compareTo value.")] + public class CompareSharedVector4 : Conditional + { + [Tooltip("The first variable to compare")] + public SharedVector4 variable; + [Tooltip("The variable to compare to")] + public SharedVector4 compareTo; + + public override TaskStatus OnUpdate() + { + return variable.Value.Equals(compareTo.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + variable = Vector4.zero; + compareTo = Vector4.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector4.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector4.cs.meta new file mode 100644 index 000000000..5db639313 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector4.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9738be23ad39d2c4ba8adc018b545ece +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/CompareSharedVector4.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedBool.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedBool.cs new file mode 100644 index 000000000..70643f06a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedBool.cs @@ -0,0 +1,26 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedBool variable to the specified object. Returns Success.")] + public class SetSharedBool : Action + { + [Tooltip("The value to set the SharedBool to")] + public SharedBool targetValue; + [RequiredField] + [Tooltip("The SharedBool to set")] + public SharedBool targetVariable; + + public override TaskStatus OnUpdate() + { + targetVariable.Value = targetValue.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetValue = false; + targetVariable = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedBool.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedBool.cs.meta new file mode 100644 index 000000000..f9d58edb8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedBool.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 54f63c79d78692a4e84e502f7cd705a6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedBool.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedColor.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedColor.cs new file mode 100644 index 000000000..663e69e72 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedColor.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedColor variable to the specified object. Returns Success.")] + public class SetSharedColor : Action + { + [Tooltip("The value to set the SharedColor to")] + public SharedColor targetValue; + [RequiredField] + [Tooltip("The SharedColor to set")] + public SharedColor targetVariable; + + public override TaskStatus OnUpdate() + { + targetVariable.Value = targetValue.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetValue = Color.black; + targetVariable = Color.black; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedColor.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedColor.cs.meta new file mode 100644 index 000000000..6bf334c3c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedColor.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 48c49264be0e7244ba46b8c970027a20 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedColor.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedFloat.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedFloat.cs new file mode 100644 index 000000000..9d6df7e8a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedFloat.cs @@ -0,0 +1,26 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedFloat variable to the specified object. Returns Success.")] + public class SetSharedFloat : Action + { + [Tooltip("The value to set the SharedFloat to")] + public SharedFloat targetValue; + [RequiredField] + [Tooltip("The SharedFloat to set")] + public SharedFloat targetVariable; + + public override TaskStatus OnUpdate() + { + targetVariable.Value = targetValue.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetValue = 0; + targetVariable = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedFloat.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedFloat.cs.meta new file mode 100644 index 000000000..b7221ab00 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedFloat.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4d5b15c88fb154446b9b1ad90cb3987f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedFloat.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedGameObject.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedGameObject.cs new file mode 100644 index 000000000..a6fd5e633 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedGameObject.cs @@ -0,0 +1,29 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedGameObject variable to the specified object. Returns Success.")] + public class SetSharedGameObject : Action + { + [Tooltip("The value to set the SharedGameObject to. If null the variable will be set to the current GameObject")] + public SharedGameObject targetValue; + [RequiredField] + [Tooltip("The SharedGameObject to set")] + public SharedGameObject targetVariable; + [Tooltip("Can the target value be null?")] + public SharedBool valueCanBeNull; + + public override TaskStatus OnUpdate() + { + targetVariable.Value = ((targetValue.Value != null || valueCanBeNull.Value) ? targetValue.Value : gameObject); + + return TaskStatus.Success; + } + + public override void OnReset() + { + valueCanBeNull = false; + targetValue = null; + targetVariable = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedGameObject.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedGameObject.cs.meta new file mode 100644 index 000000000..821728a62 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedGameObject.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: bf4af224a0ebd5946bc4f01f18d0627b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedGameObject.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedGameObjectList.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedGameObjectList.cs new file mode 100644 index 000000000..f71bef4e4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedGameObjectList.cs @@ -0,0 +1,26 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedGameObjectList variable to the specified object. Returns Success.")] + public class SetSharedGameObjectList : Action + { + [Tooltip("The value to set the SharedGameObjectList to.")] + public SharedGameObjectList targetValue; + [RequiredField] + [Tooltip("The SharedGameObjectList to set")] + public SharedGameObjectList targetVariable; + + public override TaskStatus OnUpdate() + { + targetVariable.Value = targetValue.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetValue = null; + targetVariable = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedGameObjectList.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedGameObjectList.cs.meta new file mode 100644 index 000000000..fe8836bc6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedGameObjectList.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b02b163c1dc1b894ca53f80378e39b26 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedGameObjectList.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedInt.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedInt.cs new file mode 100644 index 000000000..b62b2a914 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedInt.cs @@ -0,0 +1,26 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedInt variable to the specified object. Returns Success.")] + public class SetSharedInt : Action + { + [Tooltip("The value to set the SharedInt to")] + public SharedInt targetValue; + [RequiredField] + [Tooltip("The SharedInt to set")] + public SharedInt targetVariable; + + public override TaskStatus OnUpdate() + { + targetVariable.Value = targetValue.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetValue = 0; + targetVariable = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedInt.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedInt.cs.meta new file mode 100644 index 000000000..49af866fc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedInt.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 742d2b1426f291e45b03bcf845c53a67 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedInt.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedObject.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedObject.cs new file mode 100644 index 000000000..b6711fcc0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedObject.cs @@ -0,0 +1,26 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedObject variable to the specified object. Returns Success.")] + public class SetSharedObject : Action + { + [Tooltip("The value to set the SharedObject to")] + public SharedObject targetValue; + [RequiredField] + [Tooltip("The SharedTransform to set")] + public SharedObject targetVariable; + + public override TaskStatus OnUpdate() + { + targetVariable.Value = targetValue.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetValue = null; + targetVariable = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedObject.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedObject.cs.meta new file mode 100644 index 000000000..f54120726 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedObject.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f80da138a03cfdd4e98af96ed5f6681b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedObject.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedObjectList.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedObjectList.cs new file mode 100644 index 000000000..39ca4bb77 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedObjectList.cs @@ -0,0 +1,26 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedObjectList variable to the specified object. Returns Success.")] + public class SetSharedObjectList : Action + { + [Tooltip("The value to set the SharedObjectList to.")] + public SharedObjectList targetValue; + [RequiredField] + [Tooltip("The SharedObjectList to set")] + public SharedObjectList targetVariable; + + public override TaskStatus OnUpdate() + { + targetVariable.Value = targetValue.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetValue = null; + targetVariable = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedObjectList.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedObjectList.cs.meta new file mode 100644 index 000000000..0c35bbea9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedObjectList.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b5c211b64a2cf364e99b99dab3ce3c87 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedObjectList.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedQuaternion.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedQuaternion.cs new file mode 100644 index 000000000..acca1c590 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedQuaternion.cs @@ -0,0 +1,27 @@ +using UnityEngine; +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedQuaternion variable to the specified object. Returns Success.")] + public class SetSharedQuaternion : Action + { + [Tooltip("The value to set the SharedQuaternion to")] + public SharedQuaternion targetValue; + [RequiredField] + [Tooltip("The SharedQuaternion to set")] + public SharedQuaternion targetVariable; + + public override TaskStatus OnUpdate() + { + targetVariable.Value = targetValue.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetValue = Quaternion.identity; + targetVariable = Quaternion.identity; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedQuaternion.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedQuaternion.cs.meta new file mode 100644 index 000000000..97bc03623 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedQuaternion.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 42f84705fc5571e4088098d1239b5f46 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedQuaternion.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedRect.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedRect.cs new file mode 100644 index 000000000..a598b81bd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedRect.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedRect variable to the specified object. Returns Success.")] + public class SetSharedRect : Action + { + [Tooltip("The value to set the SharedRect to")] + public SharedRect targetValue; + [RequiredField] + [Tooltip("The SharedRect to set")] + public SharedRect targetVariable; + + public override TaskStatus OnUpdate() + { + targetVariable.Value = targetValue.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetValue = new Rect(); + targetVariable = new Rect(); + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedRect.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedRect.cs.meta new file mode 100644 index 000000000..d4bddb62e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedRect.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7313c7640a9d92b4294a7702b3c5339b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedRect.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedString.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedString.cs new file mode 100644 index 000000000..0c2c726d0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedString.cs @@ -0,0 +1,26 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedString variable to the specified object. Returns Success.")] + public class SetSharedString : Action + { + [Tooltip("The value to set the SharedString to")] + public SharedString targetValue; + [RequiredField] + [Tooltip("The SharedString to set")] + public SharedString targetVariable; + + public override TaskStatus OnUpdate() + { + targetVariable.Value = targetValue.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetValue = ""; + targetVariable = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedString.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedString.cs.meta new file mode 100644 index 000000000..a04f91da9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedString.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 92060068b2f07c54f930e1b8a8976c11 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedString.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedTransform.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedTransform.cs new file mode 100644 index 000000000..c9262941c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedTransform.cs @@ -0,0 +1,26 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedTransform variable to the specified object. Returns Success.")] + public class SetSharedTransform : Action + { + [Tooltip("The value to set the SharedTransform to. If null the variable will be set to the current Transform")] + public SharedTransform targetValue; + [RequiredField] + [Tooltip("The SharedTransform to set")] + public SharedTransform targetVariable; + + public override TaskStatus OnUpdate() + { + targetVariable.Value = (targetValue.Value != null ? targetValue.Value : transform); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetValue = null; + targetVariable = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedTransform.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedTransform.cs.meta new file mode 100644 index 000000000..2dd96a137 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedTransform.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 78e7da45e8b6c2e4cbbf4fdf474070e5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedTransform.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedTransformList.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedTransformList.cs new file mode 100644 index 000000000..198fef2a8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedTransformList.cs @@ -0,0 +1,26 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedTransformList variable to the specified object. Returns Success.")] + public class SetSharedTransformList : Action + { + [Tooltip("The value to set the SharedTransformList to.")] + public SharedTransformList targetValue; + [RequiredField] + [Tooltip("The SharedTransformList to set")] + public SharedTransformList targetVariable; + + public override TaskStatus OnUpdate() + { + targetVariable.Value = targetValue.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetValue = null; + targetVariable = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedTransformList.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedTransformList.cs.meta new file mode 100644 index 000000000..c24742a5c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedTransformList.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fae9cd59e50283949a2cc8ec460ffafe +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedTransformList.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector2.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector2.cs new file mode 100644 index 000000000..a2e67e89d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector2.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedVector2 variable to the specified object. Returns Success.")] + public class SetSharedVector2 : Action + { + [Tooltip("The value to set the SharedVector2 to")] + public SharedVector2 targetValue; + [RequiredField] + [Tooltip("The SharedVector2 to set")] + public SharedVector2 targetVariable; + + public override TaskStatus OnUpdate() + { + targetVariable.Value = targetValue.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetValue = Vector2.zero; + targetVariable = Vector2.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector2.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector2.cs.meta new file mode 100644 index 000000000..fdec003aa --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector2.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c70cf248c723950409d74c11d0781c06 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector2.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector3.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector3.cs new file mode 100644 index 000000000..d8283eec5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector3.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedVector3 variable to the specified object. Returns Success.")] + public class SetSharedVector3 : Action + { + [Tooltip("The value to set the SharedVector3 to")] + public SharedVector3 targetValue; + [RequiredField] + [Tooltip("The SharedVector3 to set")] + public SharedVector3 targetVariable; + + public override TaskStatus OnUpdate() + { + targetVariable.Value = targetValue.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetValue = Vector3.zero; + targetVariable = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector3.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector3.cs.meta new file mode 100644 index 000000000..90f7716d9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector3.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 281820e8b30038d48b4fa8f25728e6c3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector3.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector4.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector4.cs new file mode 100644 index 000000000..83572d1eb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector4.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedVector4 variable to the specified object. Returns Success.")] + public class SetSharedVector4 : Action + { + [Tooltip("The value to set the SharedVector4 to")] + public SharedVector4 targetValue; + [RequiredField] + [Tooltip("The SharedVector4 to set")] + public SharedVector4 targetVariable; + + public override TaskStatus OnUpdate() + { + targetVariable.Value = targetValue.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetValue = Vector4.zero; + targetVariable = Vector4.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector4.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector4.cs.meta new file mode 100644 index 000000000..5acb6aea8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector4.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5ca30d99da0685a4fa32d79624a5c0a0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SetSharedVector4.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedGameObjectToTransform.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedGameObjectToTransform.cs new file mode 100644 index 000000000..28e8842eb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedGameObjectToTransform.cs @@ -0,0 +1,32 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Gets the Transform from the GameObject. Returns Success.")] + public class SharedGameObjectToTransform : Action + { + [Tooltip("The GameObject to get the Transform of")] + public SharedGameObject sharedGameObject; + [RequiredField] + [Tooltip("The Transform to set")] + public SharedTransform sharedTransform; + + public override TaskStatus OnUpdate() + { + if (sharedGameObject.Value == null) { + return TaskStatus.Failure; + } + + sharedTransform.Value = sharedGameObject.Value.GetComponent(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + sharedGameObject = null; + sharedTransform = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedGameObjectToTransform.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedGameObjectToTransform.cs.meta new file mode 100644 index 000000000..55e1332d1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedGameObjectToTransform.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c08dcd1e915bef6448649ffe4d3bef3d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedGameObjectToTransform.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedGameObjectsToGameObjectList.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedGameObjectsToGameObjectList.cs new file mode 100644 index 000000000..aadcfb694 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedGameObjectsToGameObjectList.cs @@ -0,0 +1,41 @@ +using UnityEngine; +using System.Collections.Generic; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedGameObjectList values from the GameObjects. Returns Success.")] + public class SharedGameObjectsToGameObjectList : Action + { + [Tooltip("The GameObjects value")] + public SharedGameObject[] gameObjects; + [RequiredField] + [Tooltip("The SharedTransformList to set")] + public SharedGameObjectList storedGameObjectList; + + public override void OnAwake() + { + storedGameObjectList.Value = new List(); + } + + public override TaskStatus OnUpdate() + { + if (gameObjects == null || gameObjects.Length == 0) { + return TaskStatus.Failure; + } + + storedGameObjectList.Value.Clear(); + for (int i = 0; i < gameObjects.Length; ++i) { + storedGameObjectList.Value.Add(gameObjects[i].Value); + } + + return TaskStatus.Success; + } + + public override void OnReset() + { + gameObjects = null; + storedGameObjectList = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedGameObjectsToGameObjectList.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedGameObjectsToGameObjectList.cs.meta new file mode 100644 index 000000000..4ceced33d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedGameObjectsToGameObjectList.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4460871f1a9671343896ef9e56d9ceab +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedGameObjectsToGameObjectList.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedTransformToGameObject.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedTransformToGameObject.cs new file mode 100644 index 000000000..a9d9e7858 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedTransformToGameObject.cs @@ -0,0 +1,32 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Gets the GameObject from the Transform component. Returns Success.")] + public class SharedTransformToGameObject : Action + { + [Tooltip("The Transform component")] + public SharedTransform sharedTransform; + [RequiredField] + [Tooltip("The GameObject to set")] + public SharedGameObject sharedGameObject; + + public override TaskStatus OnUpdate() + { + if (sharedTransform.Value == null) { + return TaskStatus.Failure; + } + + sharedGameObject.Value = sharedTransform.Value.gameObject; + + return TaskStatus.Success; + } + + public override void OnReset() + { + sharedTransform = null; + sharedGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedTransformToGameObject.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedTransformToGameObject.cs.meta new file mode 100644 index 000000000..0d5cdd4ab --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedTransformToGameObject.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f2fd208ea1a8e1642a32148186f9e077 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedTransformToGameObject.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedTransformsToTransformList.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedTransformsToTransformList.cs new file mode 100644 index 000000000..05d3c8c45 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedTransformsToTransformList.cs @@ -0,0 +1,41 @@ +using UnityEngine; +using System.Collections.Generic; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables +{ + [TaskCategory("Unity/SharedVariable")] + [TaskDescription("Sets the SharedTransformList values from the Transforms. Returns Success.")] + public class SharedTransformsToTransformList : Action + { + [Tooltip("The Transforms value")] + public SharedTransform[] transforms; + [RequiredField] + [Tooltip("The SharedTransformList to set")] + public SharedTransformList storedTransformList; + + public override void OnAwake() + { + storedTransformList.Value = new List(); + } + + public override TaskStatus OnUpdate() + { + if (transforms == null || transforms.Length == 0) { + return TaskStatus.Failure; + } + + storedTransformList.Value.Clear(); + for (int i = 0; i < transforms.Length; ++i) { + storedTransformList.Value.Add(transforms[i].Value); + } + + return TaskStatus.Success; + } + + public override void OnReset() + { + transforms = null; + storedTransformList = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedTransformsToTransformList.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedTransformsToTransformList.cs.meta new file mode 100644 index 000000000..a4db4d78c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedTransformsToTransformList.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3533c6733499e9446b1eae98c8fcaeea +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SharedVariables/SharedTransformsToTransformList.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider.meta new file mode 100644 index 000000000..330a861c7 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 79bf48a44f2371244a34ff82aaeaaded +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/GetCenter.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/GetCenter.cs new file mode 100644 index 000000000..a8626d2dc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/GetCenter.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnitySphereCollider +{ + [TaskCategory("Unity/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(); + 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/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/GetCenter.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/GetCenter.cs.meta new file mode 100644 index 000000000..26dcbad91 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/GetCenter.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d95a2896b550c5b4382b7ed35860f504 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/GetCenter.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/GetRadius.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/GetRadius.cs new file mode 100644 index 000000000..3dc28097b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/GetRadius.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnitySphereCollider +{ + [TaskCategory("Unity/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(); + 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/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/GetRadius.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/GetRadius.cs.meta new file mode 100644 index 000000000..2d0918924 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/GetRadius.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2ff93bf538eee1444b3c51aadfc9bb7f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/GetRadius.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/SetCenter.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/SetCenter.cs new file mode 100644 index 000000000..718fd4f0c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/SetCenter.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnitySphereCollider +{ + [TaskCategory("Unity/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(); + 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/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/SetCenter.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/SetCenter.cs.meta new file mode 100644 index 000000000..ef6fd780c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/SetCenter.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: dffebfe905e60814ab75e0d7c57432ec +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/SetCenter.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/SetRadius.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/SetRadius.cs new file mode 100644 index 000000000..0c2e2fc60 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/SetRadius.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnitySphereCollider +{ + [TaskCategory("Unity/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(); + 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/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/SetRadius.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/SetRadius.cs.meta new file mode 100644 index 000000000..ffd3cfa37 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/SetRadius.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5f45a94e6b603f2498481f61218b1769 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/SphereCollider/SetRadius.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String.meta new file mode 100644 index 000000000..738cfb1b7 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: f1fb420b7a56bfa4ebafed6237009045 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/BuildString.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/BuildString.cs new file mode 100644 index 000000000..884d4b11f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/BuildString.cs @@ -0,0 +1,28 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityString +{ + [TaskCategory("Unity/String")] + [TaskDescription("Creates a string from multiple other strings.")] + public class BuildString : Action + { + [Tooltip("The array of strings")] + public SharedString[] source; + [Tooltip("The stored result")] + [RequiredField] + public SharedString storeResult; + + public override TaskStatus OnUpdate() + { + for (int i = 0; i < source.Length; ++i) { + storeResult.Value += source[i]; + } + + return TaskStatus.Success; + } + + public override void OnReset() + { + source = null; + storeResult = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/BuildString.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/BuildString.cs.meta new file mode 100644 index 000000000..fc1984785 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/BuildString.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9373af75c434e1a4784c2a165ad3ce3b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/String/BuildString.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/CompareTo.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/CompareTo.cs new file mode 100644 index 000000000..92448f6a7 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/CompareTo.cs @@ -0,0 +1,28 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityString +{ + [TaskCategory("Unity/String")] + [TaskDescription("Compares the first string to the second string. Returns an int which indicates whether the first string precedes, matches, or follows the second string.")] + public class CompareTo : Action + { + [Tooltip("The string to compare")] + public SharedString firstString; + [Tooltip("The string to compare to")] + public SharedString secondString; + [Tooltip("The stored result")] + [RequiredField] + public SharedInt storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = firstString.Value.CompareTo(secondString.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + firstString = ""; + secondString = ""; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/CompareTo.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/CompareTo.cs.meta new file mode 100644 index 000000000..a1f33e7e8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/CompareTo.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c752378530d87cb4c98ba15e55936abf +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/String/CompareTo.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/Format.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/Format.cs new file mode 100644 index 000000000..02d899bfb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/Format.cs @@ -0,0 +1,47 @@ +using UnityEngine; +using System; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityString +{ + [TaskCategory("Unity/String")] + [TaskDescription("Stores a string with the specified format.")] + public class Format : Action + { + [Tooltip("The format of the string")] + public SharedString format; + [Tooltip("Any variables to appear in the string")] + public SharedGenericVariable[] variables; + [Tooltip("The result of the format")] + [RequiredField] + public SharedString storeResult; + + private object[] variableValues; + + public override void OnAwake() + { + variableValues = new object[variables.Length]; + } + + public override TaskStatus OnUpdate() + { + for (int i = 0; i < variableValues.Length; ++i) { + variableValues[i] = variables[i].Value.value.GetValue(); + } + + try { + storeResult.Value = string.Format(format.Value, variableValues); + } catch (Exception e) { + Debug.LogError(e.Message); + return TaskStatus.Failure; + } + return TaskStatus.Success; + } + + public override void OnReset() + { + format = ""; + variables = null; + storeResult = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/Format.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/Format.cs.meta new file mode 100644 index 000000000..2d5c06a77 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/Format.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d96c5da37483da346b96ef02fde824cb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/String/Format.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetLength.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetLength.cs new file mode 100644 index 000000000..82dfed2a8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetLength.cs @@ -0,0 +1,25 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityString +{ + [TaskCategory("Unity/String")] + [TaskDescription("Stores the length of the string")] + public class GetLength : Action + { + [Tooltip("The target string")] + public SharedString targetString; + [Tooltip("The stored result")] + [RequiredField] + public SharedInt storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = targetString.Value.Length; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetString = ""; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetLength.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetLength.cs.meta new file mode 100644 index 000000000..54554d50b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetLength.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5ab3e7e038a50c14f9fa0b019399f3be +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetLength.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetRandomString.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetRandomString.cs new file mode 100644 index 000000000..8cf97603f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetRandomString.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityString +{ + [TaskCategory("Unity/String")] + [TaskDescription("Randomly selects a string from the array of strings.")] + public class GetRandomString : Action + { + [Tooltip("The array of strings")] + public SharedString[] source; + [Tooltip("The stored result")] + [RequiredField] + public SharedString storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = source[Random.Range(0, source.Length)].Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + source = null; + storeResult = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetRandomString.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetRandomString.cs.meta new file mode 100644 index 000000000..01648aaf3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetRandomString.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 355abdec2d73d2545b16d5e0d5f4c589 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetRandomString.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetSubstring.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetSubstring.cs new file mode 100644 index 000000000..56db62377 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetSubstring.cs @@ -0,0 +1,35 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityString +{ + [TaskCategory("Unity/String")] + [TaskDescription("Stores a substring of the target string")] + public class GetSubstring : Action + { + [Tooltip("The target string")] + public SharedString targetString; + [Tooltip("The start substring index")] + public SharedInt startIndex = 0; + [Tooltip("The length of the substring. Don't use if -1")] + public SharedInt length = -1; + [Tooltip("The stored result")] + [RequiredField] + public SharedString storeResult; + + public override TaskStatus OnUpdate() + { + if (length.Value != -1) { + storeResult.Value = targetString.Value.Substring(startIndex.Value, length.Value); + } else { + storeResult.Value = targetString.Value.Substring(startIndex.Value); + } + return TaskStatus.Success; + } + + public override void OnReset() + { + targetString = ""; + startIndex = 0; + length = -1; + storeResult = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetSubstring.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetSubstring.cs.meta new file mode 100644 index 000000000..3766a750c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetSubstring.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6ce20430f88c32b418f29b42531eca4a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/String/GetSubstring.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/IsNullOrEmpty.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/IsNullOrEmpty.cs new file mode 100644 index 000000000..4f91f749d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/IsNullOrEmpty.cs @@ -0,0 +1,20 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityString +{ + [TaskCategory("Unity/String")] + [TaskDescription("Returns success if the string is null or empty")] + public class IsNullOrEmpty : Conditional + { + [Tooltip("The target string")] + public SharedString targetString; + + public override TaskStatus OnUpdate() + { + return string.IsNullOrEmpty(targetString.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetString = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/IsNullOrEmpty.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/IsNullOrEmpty.cs.meta new file mode 100644 index 000000000..42ca65d43 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/IsNullOrEmpty.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f6f4d4c690c09bb48a388f36f4e30245 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/String/IsNullOrEmpty.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/Replace.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/Replace.cs new file mode 100644 index 000000000..86fd98d09 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/Replace.cs @@ -0,0 +1,32 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityString +{ + [TaskCategory("Unity/String")] + [TaskDescription("Replaces a string with the new string")] + public class Replace : Action + { + [Tooltip("The target string")] + public SharedString targetString; + [Tooltip("The old replace")] + public SharedString oldString; + [Tooltip("The new string")] + public SharedString newString; + [Tooltip("The stored result")] + [RequiredField] + public SharedString storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = targetString.Value.Replace(oldString.Value, newString.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetString = ""; + oldString = ""; + newString = ""; + storeResult = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/Replace.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/Replace.cs.meta new file mode 100644 index 000000000..d5ee15228 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/Replace.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 30fc7adfdddc39245a433ea477c01adf +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/String/Replace.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/SetString.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/SetString.cs new file mode 100644 index 000000000..96060db7b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/SetString.cs @@ -0,0 +1,26 @@ +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityString +{ + [TaskCategory("Unity/String")] + [TaskDescription("Sets the variable string to the value string.")] + public class SetString : Action + { + [Tooltip("The target string")] + [RequiredField] + public SharedString variable; + [Tooltip("The value string")] + public SharedString value; + + public override TaskStatus OnUpdate() + { + variable.Value = value.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + variable = ""; + value = ""; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/SetString.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/SetString.cs.meta new file mode 100644 index 000000000..2ff4c543a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/String/SetString.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: da59105cbc94b5d4da3c805897f4a099 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/String/SetString.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time.meta new file mode 100644 index 000000000..e59fe44b9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d8d2d4d347504b146a2c930a2b806d71 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetDeltaTime.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetDeltaTime.cs new file mode 100644 index 000000000..0a8e5f5b1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetDeltaTime.cs @@ -0,0 +1,23 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTime +{ + [TaskCategory("Unity/Time")] + [TaskDescription("Returns the time in seconds it took to complete the last frame.")] + public class GetDeltaTime : Action + { + [Tooltip("The variable to store the result")] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Time.deltaTime; + return TaskStatus.Success; + } + + public override void OnReset() + { + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetDeltaTime.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetDeltaTime.cs.meta new file mode 100644 index 000000000..0f5ffacf8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetDeltaTime.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d9d47b1b40fc1214298a3f6bfdc37e87 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetDeltaTime.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetRealtimeSinceStartup.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetRealtimeSinceStartup.cs new file mode 100644 index 000000000..43bd70b0a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetRealtimeSinceStartup.cs @@ -0,0 +1,23 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTime +{ + [TaskCategory("Unity/Time")] + [TaskDescription("Returns the real time in seconds since the game started.")] + public class GetRealtimeSinceStartup : Action + { + [Tooltip("The variable to store the result")] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Time.realtimeSinceStartup; + return TaskStatus.Success; + } + + public override void OnReset() + { + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetRealtimeSinceStartup.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetRealtimeSinceStartup.cs.meta new file mode 100644 index 000000000..88fe5573b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetRealtimeSinceStartup.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c265b103d220b0e4fa45138fcd605f62 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetRealtimeSinceStartup.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetTime.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetTime.cs new file mode 100644 index 000000000..3bae7705e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetTime.cs @@ -0,0 +1,23 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTime +{ + [TaskCategory("Unity/Time")] + [TaskDescription("Returns the time in second since the start of the game.")] + public class GetTime : Action + { + [Tooltip("The variable to store the result")] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Time.time; + return TaskStatus.Success; + } + + public override void OnReset() + { + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetTime.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetTime.cs.meta new file mode 100644 index 000000000..b88a3eff6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetTime.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5afd2ca3dda059243bf7a9156438475e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetTime.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetTimeScale.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetTimeScale.cs new file mode 100644 index 000000000..4df0525ac --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetTimeScale.cs @@ -0,0 +1,23 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTime +{ + [TaskCategory("Unity/Time")] + [TaskDescription("Returns the scale at which time is passing.")] + public class GetTimeScale : Action + { + [Tooltip("The variable to store the result")] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Time.timeScale; + return TaskStatus.Success; + } + + public override void OnReset() + { + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetTimeScale.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetTimeScale.cs.meta new file mode 100644 index 000000000..1a8deed28 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetTimeScale.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 79be8ba43b4c1db468d2476318e7e71a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Time/GetTimeScale.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/SetTimeScale.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/SetTimeScale.cs new file mode 100644 index 000000000..d315b194b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/SetTimeScale.cs @@ -0,0 +1,23 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTime +{ + [TaskCategory("Unity/Time")] + [TaskDescription("Sets the scale at which time is passing.")] + public class SetTimeScale : Action + { + [Tooltip("The timescale")] + public SharedFloat timeScale; + + public override TaskStatus OnUpdate() + { + Time.timeScale = timeScale.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + timeScale.Value = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/SetTimeScale.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/SetTimeScale.cs.meta new file mode 100644 index 000000000..ebd9c89da --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Time/SetTimeScale.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6283d9f4bb690c64b9d986b6ff1271f0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Time/SetTimeScale.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline.meta new file mode 100644 index 000000000..0ceb76af2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 50e6b8a5d6bb9cb49957395165f737a7 +folderAsset: yes +timeCreated: 1519216643 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/IsPaused.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/IsPaused.cs new file mode 100644 index 000000000..f502f087f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/IsPaused.cs @@ -0,0 +1,40 @@ +using UnityEngine; +using UnityEngine.Playables; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Timeline +{ + [TaskCategory("Unity/Timeline")] + [TaskDescription("Is the timeline currently paused?")] + public class IsPaused : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private PlayableDirector playableDirector; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + playableDirector = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (playableDirector == null) { + Debug.LogWarning("PlayableDirector is null"); + return TaskStatus.Failure; + } + + return playableDirector.state == PlayState.Paused ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/IsPaused.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/IsPaused.cs.meta new file mode 100644 index 000000000..d27b5a0c7 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/IsPaused.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 52231614084966e4ea648e3293e3de67 +timeCreated: 1519216674 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/IsPaused.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/IsPlaying.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/IsPlaying.cs new file mode 100644 index 000000000..bf1331bb5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/IsPlaying.cs @@ -0,0 +1,40 @@ +using UnityEngine; +using UnityEngine.Playables; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Timeline +{ + [TaskCategory("Unity/Timeline")] + [TaskDescription("Is the timeline currently playing?")] + public class IsPlaying : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private PlayableDirector playableDirector; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + playableDirector = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (playableDirector == null) { + Debug.LogWarning("PlayableDirector is null"); + return TaskStatus.Failure; + } + + return playableDirector.state == PlayState.Playing ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/IsPlaying.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/IsPlaying.cs.meta new file mode 100644 index 000000000..04d30449c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/IsPlaying.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 61a5af2ddf414484cb4f4048f2342c4f +timeCreated: 1519216674 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/IsPlaying.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Pause.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Pause.cs new file mode 100644 index 000000000..449aa24aa --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Pause.cs @@ -0,0 +1,42 @@ +using UnityEngine; +using UnityEngine.Playables; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Timeline +{ + [TaskCategory("Unity/Timeline")] + [TaskDescription("Pauses playback of the currently running playable.")] + public class Pause : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private PlayableDirector playableDirector; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + playableDirector = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (playableDirector == null) { + Debug.LogWarning("PlayableDirector is null"); + return TaskStatus.Failure; + } + + playableDirector.Pause(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Pause.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Pause.cs.meta new file mode 100644 index 000000000..daf009742 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Pause.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 158fd9e1af5fac248913c0f749720737 +timeCreated: 1519216674 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Pause.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Play.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Play.cs new file mode 100644 index 000000000..b1ab42ea1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Play.cs @@ -0,0 +1,62 @@ +using UnityEngine; +using UnityEngine.Playables; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Timeline +{ + [TaskCategory("Unity/Timeline")] + [TaskDescription("Instatiates a Playable using the provided PlayableAsset and starts playback.")] + public class Play : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("An asset to instantiate a playable from.")] + public PlayableAsset playableAsset; + [Tooltip("Should the task be stopped when the timeline has stopped playing?")] + public SharedBool stopWhenComplete; + + private PlayableDirector playableDirector; + private GameObject prevGameObject; + private bool playbackStarted; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + playableDirector = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + playbackStarted = false; + } + + public override TaskStatus OnUpdate() + { + if (playableDirector == null) { + Debug.LogWarning("PlayableDirector is null"); + return TaskStatus.Failure; + } + + if (playbackStarted) { + if (stopWhenComplete.Value && playableDirector.state == PlayState.Playing) { + return TaskStatus.Running; + } + return TaskStatus.Success; + } + + if (playableAsset == null) { + playableDirector.Play(); + } else { + playableDirector.Play(playableAsset); + } + playbackStarted = true; + + return stopWhenComplete.Value ? TaskStatus.Running : TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + playableAsset = null; + stopWhenComplete = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Play.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Play.cs.meta new file mode 100644 index 000000000..aef501d7f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Play.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3268be37f87a5134e8c90f65a338172e +timeCreated: 1519216674 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Play.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Resume.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Resume.cs new file mode 100644 index 000000000..c665f53c1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Resume.cs @@ -0,0 +1,55 @@ +using UnityEngine; +using UnityEngine.Playables; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Timeline +{ + [TaskCategory("Unity/Timeline")] + [TaskDescription("Resume playing a paused playable.")] + public class Resume : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Should the task be stopped when the timeline has stopped playing?")] + public SharedBool stopWhenComplete; + + private PlayableDirector playableDirector; + private GameObject prevGameObject; + private bool playbackStarted; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + playableDirector = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + playbackStarted = false; + } + + public override TaskStatus OnUpdate() + { + if (playableDirector == null) { + Debug.LogWarning("PlayableDirector is null"); + return TaskStatus.Failure; + } + + if (playbackStarted) { + if (stopWhenComplete.Value && playableDirector.state == PlayState.Playing) { + return TaskStatus.Running; + } + return TaskStatus.Success; + } + + playableDirector.Resume(); + playbackStarted = true; + + return stopWhenComplete.Value ? TaskStatus.Running : TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + stopWhenComplete = false; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Resume.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Resume.cs.meta new file mode 100644 index 000000000..e3181963a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Resume.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 08ea323394eb79c48a2aa692cb4e82ac +timeCreated: 1519216674 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Resume.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Stop.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Stop.cs new file mode 100644 index 000000000..733126714 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Stop.cs @@ -0,0 +1,42 @@ +using UnityEngine; +using UnityEngine.Playables; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.Timeline +{ + [TaskCategory("Unity/Timeline")] + [TaskDescription("Stops playback of the current Playable and destroys the corresponding graph.")] + public class Stop : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private PlayableDirector playableDirector; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + playableDirector = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (playableDirector == null) { + Debug.LogWarning("PlayableDirector is null"); + return TaskStatus.Failure; + } + + playableDirector.Stop(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Stop.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Stop.cs.meta new file mode 100644 index 000000000..909532fc2 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Stop.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 7941758d54ddf364ca7b43af93da05ec +timeCreated: 1519216674 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Timeline/Stop.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform.meta new file mode 100644 index 000000000..633ff139c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d2f1ebdae5c7ffb4d8c7a9daa37b5130 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Find.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Find.cs new file mode 100644 index 000000000..2a8f89384 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Find.cs @@ -0,0 +1,48 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Finds a transform by name. Returns success if an object is found.")] + public class Find : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The transform name to find")] + public SharedString transformName; + [Tooltip("The object found by name")] + [RequiredField] + public SharedTransform storeValue; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + storeValue.Value = targetTransform.Find(transformName.Value); + + return storeValue.Value != null ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + transformName = null; + storeValue = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Find.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Find.cs.meta new file mode 100644 index 000000000..8bc41a25d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Find.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 387fd22087393ab4e91f0ad4fce4e77f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Find.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetAngleToTarget.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetAngleToTarget.cs new file mode 100644 index 000000000..370c2b02d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetAngleToTarget.cs @@ -0,0 +1,66 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Gets the Angle between a GameObject's forward direction and a target. Returns Success.")] + public class GetAngleToTarget : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The target object to measure the angle to. If null the targetPosition will be used.")] + public SharedGameObject targetObject; + [Tooltip("The world position to measure an angle to. If the targetObject is also not null, this value is used as an offset from that object's position.")] + public SharedVector3 targetPosition; + [Tooltip("Ignore height differences when calculating the angle?")] + public SharedBool ignoreHeight = true; + [Tooltip("The angle to the target")] + [RequiredField] + public SharedFloat storeValue; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + Vector3 targetPos; + if (targetObject.Value != null) { + targetPos = targetObject.Value.transform.InverseTransformPoint(targetPosition.Value); + } else { + targetPos = targetPosition.Value; + } + + if (ignoreHeight.Value) { + targetPos.y = targetTransform.position.y; + } + + var targetDir = targetPos - targetTransform.position; + storeValue.Value = Vector3.Angle(targetDir, targetTransform.forward); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + targetObject = null; + targetPosition = Vector3.zero; + ignoreHeight = true; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetAngleToTarget.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetAngleToTarget.cs.meta new file mode 100644 index 000000000..776300401 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetAngleToTarget.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ae176a605fff9a2468198085313c26ad +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetAngleToTarget.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetChild.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetChild.cs new file mode 100644 index 000000000..9a12c8aab --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetChild.cs @@ -0,0 +1,48 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Stores the transform child at the specified index. Returns Success.")] + public class GetChild : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The index of the child")] + public SharedInt index; + [Tooltip("The child of the Transform")] + [RequiredField] + public SharedTransform storeValue; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + storeValue.Value = targetTransform.GetChild(index.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + index = 0; + storeValue = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetChild.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetChild.cs.meta new file mode 100644 index 000000000..cb656fa06 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetChild.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 04ea225bb12181a4daf7f3d6a21eaa5d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetChild.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetChildCount.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetChildCount.cs new file mode 100644 index 000000000..faa7a03b3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetChildCount.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Stores the number of children a Transform has. Returns Success.")] + public class GetChildCount : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The number of children")] + [RequiredField] + public SharedInt storeValue; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + storeValue.Value = targetTransform.childCount; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetChildCount.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetChildCount.cs.meta new file mode 100644 index 000000000..433b83da0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetChildCount.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8e31c13112e4d334ab9d67feaac94d3f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetChildCount.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetEulerAngles.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetEulerAngles.cs new file mode 100644 index 000000000..f44f0f13c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetEulerAngles.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Stores the euler angles of the Transform. Returns Success.")] + public class GetEulerAngles : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The euler angles of the Transform")] + [RequiredField] + public SharedVector3 storeValue; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + storeValue.Value = targetTransform.eulerAngles; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetEulerAngles.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetEulerAngles.cs.meta new file mode 100644 index 000000000..5797f6166 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetEulerAngles.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 43295a23f5d9cb345ae408d5ac843b52 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetEulerAngles.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetForwardVector.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetForwardVector.cs new file mode 100644 index 000000000..a98596df9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetForwardVector.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Stores the forward vector of the Transform. Returns Success.")] + public class GetForwardVector : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The position of the Transform")] + [RequiredField] + public SharedVector3 storeValue; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + storeValue.Value = targetTransform.forward; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetForwardVector.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetForwardVector.cs.meta new file mode 100644 index 000000000..3016f503e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetForwardVector.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a5748c07a5ebe54429eb3e9ae032b5e2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetForwardVector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalEulerAngles.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalEulerAngles.cs new file mode 100644 index 000000000..fddd98bb8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalEulerAngles.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Stores the local euler angles of the Transform. Returns Success.")] + public class GetLocalEulerAngles : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The local euler angles of the Transform")] + [RequiredField] + public SharedVector3 storeValue; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + storeValue.Value = targetTransform.localEulerAngles; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalEulerAngles.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalEulerAngles.cs.meta new file mode 100644 index 000000000..4d5c63c40 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalEulerAngles.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 459c793e1b836104f901813471414ccc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalEulerAngles.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalPosition.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalPosition.cs new file mode 100644 index 000000000..084b111e7 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalPosition.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Stores the local position of the Transform. Returns Success.")] + public class GetLocalPosition : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The local position of the Transform")] + [RequiredField] + public SharedVector3 storeValue; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + storeValue.Value = targetTransform.localPosition; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalPosition.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalPosition.cs.meta new file mode 100644 index 000000000..5cbf32330 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalPosition.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4fdc0d751b2c91f438142cf65fcbba34 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalPosition.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalRotation.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalRotation.cs new file mode 100644 index 000000000..992c0344c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalRotation.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Stores the local rotation of the Transform. Returns Success.")] + public class GetLocalRotation : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The local rotation of the Transform")] + [RequiredField] + public SharedQuaternion storeValue; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + storeValue.Value = targetTransform.localRotation; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Quaternion.identity; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalRotation.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalRotation.cs.meta new file mode 100644 index 000000000..7ccde25e8 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalRotation.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2334ddf0e58b67e40ad16e2f63dad8ee +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalRotation.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalScale.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalScale.cs new file mode 100644 index 000000000..efc187ece --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalScale.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Stores the local scale of the Transform. Returns Success.")] + public class GetLocalScale : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The local scale of the Transform")] + [RequiredField] + public SharedVector3 storeValue; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + storeValue.Value = targetTransform.localScale; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalScale.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalScale.cs.meta new file mode 100644 index 000000000..ec0504d4e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalScale.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e0b10fe3fcda1914fbbdde4a860cd403 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetLocalScale.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetParent.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetParent.cs new file mode 100644 index 000000000..d29f7aa8b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetParent.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Stores the parent of the Transform. Returns Success.")] + public class GetParent : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The parent of the Transform")] + [RequiredField] + public SharedTransform storeValue; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + storeValue.Value = targetTransform.parent; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetParent.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetParent.cs.meta new file mode 100644 index 000000000..8c4cacacb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetParent.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f149245d8fce789498c301657a7eaf88 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetParent.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetPosition.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetPosition.cs new file mode 100644 index 000000000..c5151fc23 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetPosition.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Stores the position of the Transform. Returns Success.")] + public class GetPosition : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Can the target GameObject be empty?")] + [RequiredField] + public SharedVector3 storeValue; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + storeValue.Value = targetTransform.position; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetPosition.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetPosition.cs.meta new file mode 100644 index 000000000..bff6855fe --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetPosition.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9ce1fdc3f652b3043b5116efba12cc48 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetPosition.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetRightVector.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetRightVector.cs new file mode 100644 index 000000000..4bc1b3664 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetRightVector.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Stores the right vector of the Transform. Returns Success.")] + public class GetRightVector : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The position of the Transform")] + [RequiredField] + public SharedVector3 storeValue; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + storeValue.Value = targetTransform.right; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetRightVector.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetRightVector.cs.meta new file mode 100644 index 000000000..4f926e79a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetRightVector.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6b5147164f2674547888db24cba68770 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetRightVector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetRotation.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetRotation.cs new file mode 100644 index 000000000..bb1c43998 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetRotation.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Stores the rotation of the Transform. Returns Success.")] + public class GetRotation : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The rotation of the Transform")] + [RequiredField] + public SharedQuaternion storeValue; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + storeValue.Value = targetTransform.rotation; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Quaternion.identity; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetRotation.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetRotation.cs.meta new file mode 100644 index 000000000..5a09737cb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetRotation.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5384b69809f40f5489ca7d7d345471d2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetRotation.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetUpVector.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetUpVector.cs new file mode 100644 index 000000000..abb5ef189 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetUpVector.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Stores the up vector of the Transform. Returns Success.")] + public class GetUpVector : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The position of the Transform")] + [RequiredField] + public SharedVector3 storeValue; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + storeValue.Value = targetTransform.up; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetUpVector.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetUpVector.cs.meta new file mode 100644 index 000000000..7c77cb9a4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetUpVector.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 605a7c93705031042be47bd4a4ab6079 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/GetUpVector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/IsChildOf.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/IsChildOf.cs new file mode 100644 index 000000000..f26259368 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/IsChildOf.cs @@ -0,0 +1,42 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Returns Success if the transform is a child of the specified GameObject.")] + public class IsChildOf : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The interested transform")] + public SharedTransform transformName; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + return targetTransform.IsChildOf(transformName.Value) ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + transformName = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/IsChildOf.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/IsChildOf.cs.meta new file mode 100644 index 000000000..738cb72cf --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/IsChildOf.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 304e488eb1caa4f45a8bd903292492ca +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/IsChildOf.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/LookAt.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/LookAt.cs new file mode 100644 index 000000000..a1ddca1c4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/LookAt.cs @@ -0,0 +1,54 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Rotates the transform so the forward vector points at worldPosition. Returns Success.")] + public class LookAt : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The GameObject to look at. If null the world position will be used.")] + public SharedGameObject targetLookAt; + [Tooltip("Point to look at")] + public SharedVector3 worldPosition; + [Tooltip("Vector specifying the upward direction")] + public Vector3 worldUp; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + if (targetLookAt.Value != null) { + targetTransform.LookAt(targetLookAt.Value.transform); + } else { + targetTransform.LookAt(worldPosition.Value, worldUp); + } + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + targetLookAt = null; + worldPosition = Vector3.up; + worldUp = Vector3.up; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/LookAt.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/LookAt.cs.meta new file mode 100644 index 000000000..1d3469d28 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/LookAt.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 64883614392671f438244b3aa5b91c6c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/LookAt.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Rotate.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Rotate.cs new file mode 100644 index 000000000..85415277b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Rotate.cs @@ -0,0 +1,47 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Applies a rotation. Returns Success.")] + public class Rotate : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Amount to rotate")] + public SharedVector3 eulerAngles; + [Tooltip("Specifies which axis the rotation is relative to")] + public Space relativeTo = Space.Self; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + targetTransform.Rotate(eulerAngles.Value, relativeTo); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + eulerAngles = Vector3.zero; + relativeTo = Space.Self; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Rotate.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Rotate.cs.meta new file mode 100644 index 000000000..0a2774adc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Rotate.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: db0cba6372babb541a0da57412963760 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Rotate.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/RotateAround.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/RotateAround.cs new file mode 100644 index 000000000..b36fa3df7 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/RotateAround.cs @@ -0,0 +1,50 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Applies a rotation. Returns Success.")] + public class RotateAround : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Point to rotate around")] + public SharedVector3 point; + [Tooltip("Axis to rotate around")] + public SharedVector3 axis; + [Tooltip("Amount to rotate")] + public SharedFloat angle; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + targetTransform.RotateAround(point.Value, axis.Value, angle.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + point = Vector3.zero; + axis = Vector3.zero; + angle = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/RotateAround.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/RotateAround.cs.meta new file mode 100644 index 000000000..df8666b6c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/RotateAround.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 65cef920fcc4ec449a1e6a29fe79c024 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/RotateAround.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetEulerAngles.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetEulerAngles.cs new file mode 100644 index 000000000..249c3682e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetEulerAngles.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Sets the euler angles of the Transform. Returns Success.")] + public class SetEulerAngles : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The euler angles of the Transform")] + public SharedVector3 eulerAngles; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + targetTransform.eulerAngles = eulerAngles.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + eulerAngles = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetEulerAngles.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetEulerAngles.cs.meta new file mode 100644 index 000000000..9a8903d17 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetEulerAngles.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: edad3f12ad10ba14aac656b7f431ff31 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetEulerAngles.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetForwardVector.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetForwardVector.cs new file mode 100644 index 000000000..9c7369131 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetForwardVector.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Sets the forward vector of the Transform. Returns Success.")] + public class SetForwardVector : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The position of the Transform")] + public SharedVector3 position; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + targetTransform.forward = position.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + position = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetForwardVector.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetForwardVector.cs.meta new file mode 100644 index 000000000..0f149571a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetForwardVector.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4cf669b5419d7294cb72c90881267c0c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetForwardVector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalEulerAngles.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalEulerAngles.cs new file mode 100644 index 000000000..9fd68c04e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalEulerAngles.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Sets the local euler angles of the Transform. Returns Success.")] + public class SetLocalEulerAngles : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The local euler angles of the Transform")] + public SharedVector3 localEulerAngles; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + targetTransform.localEulerAngles = localEulerAngles.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + localEulerAngles = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalEulerAngles.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalEulerAngles.cs.meta new file mode 100644 index 000000000..fb8d36862 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalEulerAngles.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2e1ed691ebf9f154e88bb8be7319baad +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalEulerAngles.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalPosition.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalPosition.cs new file mode 100644 index 000000000..7d276aeed --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalPosition.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Sets the local position of the Transform. Returns Success.")] + public class SetLocalPosition : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The local position of the Transform")] + public SharedVector3 localPosition; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + targetTransform.localPosition = localPosition.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + localPosition = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalPosition.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalPosition.cs.meta new file mode 100644 index 000000000..82c235336 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalPosition.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5af08673c7a3bb54c974bb23094d4587 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalPosition.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalRotation.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalRotation.cs new file mode 100644 index 000000000..a7ead69cb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalRotation.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Sets the local rotation of the Transform. Returns Success.")] + public class SetLocalRotation : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The local rotation of the Transform")] + public SharedQuaternion localRotation; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + targetTransform.localRotation = localRotation.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + localRotation = Quaternion.identity; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalRotation.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalRotation.cs.meta new file mode 100644 index 000000000..7e6d5f934 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalRotation.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: de22c6e6826367540b2f25957757a1d4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalRotation.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalScale.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalScale.cs new file mode 100644 index 000000000..381f8435a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalScale.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Sets the local scale of the Transform. Returns Success.")] + public class SetLocalScale : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The local scale of the Transform")] + public SharedVector3 localScale; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + targetTransform.localScale = localScale.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + localScale = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalScale.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalScale.cs.meta new file mode 100644 index 000000000..300f29254 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalScale.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 354ce71974ea2b44ab820c8285f72421 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetLocalScale.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetParent.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetParent.cs new file mode 100644 index 000000000..80e3f7d48 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetParent.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Sets the parent of the Transform. Returns Success.")] + public class SetParent : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The parent of the Transform")] + public SharedTransform parent; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + targetTransform.parent = parent.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + parent = null; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetParent.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetParent.cs.meta new file mode 100644 index 000000000..74ec3d78b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetParent.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a19c91d6c31b48d45b2ea97efeae14aa +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetParent.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetPosition.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetPosition.cs new file mode 100644 index 000000000..250d78f52 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetPosition.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Sets the position of the Transform. Returns Success.")] + public class SetPosition : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The position of the Transform")] + public SharedVector3 position; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + targetTransform.position = position.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + position = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetPosition.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetPosition.cs.meta new file mode 100644 index 000000000..b113b60ca --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetPosition.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d0586a5078618624398df51fd677a2e0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetPosition.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetRightVector.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetRightVector.cs new file mode 100644 index 000000000..2d94fed8f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetRightVector.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Sets the right vector of the Transform. Returns Success.")] + public class SetRightVector : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The position of the Transform")] + public SharedVector3 position; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + targetTransform.right = position.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + position = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetRightVector.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetRightVector.cs.meta new file mode 100644 index 000000000..ee1e2892c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetRightVector.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4629bee77af22ca42a716dfa8ad3e669 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetRightVector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetRotation.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetRotation.cs new file mode 100644 index 000000000..76038c47d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetRotation.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Sets the rotation of the Transform. Returns Success.")] + public class SetRotation : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The rotation of the Transform")] + public SharedQuaternion rotation; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + targetTransform.rotation = rotation.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + rotation = Quaternion.identity; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetRotation.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetRotation.cs.meta new file mode 100644 index 000000000..f1b62c4c0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetRotation.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fb61cc6175ff14c4d84c3c72541bc30d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetRotation.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetUpVector.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetUpVector.cs new file mode 100644 index 000000000..d1895249c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetUpVector.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Sets the up vector of the Transform. Returns Success.")] + public class SetUpVector : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The position of the Transform")] + public SharedVector3 position; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + targetTransform.up = position.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + position = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetUpVector.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetUpVector.cs.meta new file mode 100644 index 000000000..0c505dc01 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetUpVector.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2e65dee462c24694a9835796a770af6e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/SetUpVector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Translate.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Translate.cs new file mode 100644 index 000000000..439c83a25 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Translate.cs @@ -0,0 +1,47 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityTransform +{ + [TaskCategory("Unity/Transform")] + [TaskDescription("Moves the transform in the direction and distance of translation. Returns Success.")] + public class Translate : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Move direction and distance")] + public SharedVector3 translation; + [Tooltip("Specifies which axis the rotation is relative to")] + public Space relativeTo = Space.Self; + + private Transform targetTransform; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + targetTransform = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (targetTransform == null) { + Debug.LogWarning("Transform is null"); + return TaskStatus.Failure; + } + + targetTransform.Translate(translation.Value, relativeTo); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + translation = Vector3.zero; + relativeTo = Space.Self; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Translate.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Translate.cs.meta new file mode 100644 index 000000000..385fc3c66 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Translate.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d4a788705b79d3745a26867acf47a63a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Transform/Translate.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2.meta new file mode 100644 index 000000000..a0115a94b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: ea5a99c944135bb47be3809004f4ca10 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/ClampMagnitude.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/ClampMagnitude.cs new file mode 100644 index 000000000..a1dbc698d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/ClampMagnitude.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2 +{ + [TaskCategory("Unity/Vector2")] + [TaskDescription("Clamps the magnitude of the Vector2.")] + public class ClampMagnitude : Action + { + [Tooltip("The Vector2 to clamp the magnitude of")] + public SharedVector2 vector2Variable; + [Tooltip("The max length of the magnitude")] + public SharedFloat maxLength; + [Tooltip("The clamp magnitude resut")] + [RequiredField] + public SharedVector2 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector2.ClampMagnitude(vector2Variable.Value, maxLength.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + vector2Variable = Vector2.zero; + storeResult = Vector2.zero; + maxLength = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/ClampMagnitude.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/ClampMagnitude.cs.meta new file mode 100644 index 000000000..e4cdc6aec --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/ClampMagnitude.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a2a5d2ecd681ef64ea5b5fbf81cc0b2d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/ClampMagnitude.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Distance.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Distance.cs new file mode 100644 index 000000000..9be80d656 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Distance.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2 +{ + [TaskCategory("Unity/Vector2")] + [TaskDescription("Returns the distance between two Vector2s.")] + public class Distance : Action + { + [Tooltip("The first Vector2")] + public SharedVector2 firstVector2; + [Tooltip("The second Vector2")] + public SharedVector2 secondVector2; + [Tooltip("The distance")] + [RequiredField] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector2.Distance(firstVector2.Value, secondVector2.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + firstVector2 = Vector2.zero; + secondVector2 = Vector2.zero; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Distance.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Distance.cs.meta new file mode 100644 index 000000000..564de51e3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Distance.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a35c2cb53a768894f8d81c2e8dc87b9b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Distance.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Dot.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Dot.cs new file mode 100644 index 000000000..1d57a5d41 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Dot.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2 +{ + [TaskCategory("Unity/Vector2")] + [TaskDescription("Stores the dot product of two Vector2 values.")] + public class Dot : Action + { + [Tooltip("The left hand side of the dot product")] + public SharedVector2 leftHandSide; + [Tooltip("The right hand side of the dot product")] + public SharedVector2 rightHandSide; + [Tooltip("The dot product result")] + [RequiredField] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector2.Dot(leftHandSide.Value, rightHandSide.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + leftHandSide = Vector2.zero; + rightHandSide = Vector2.zero; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Dot.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Dot.cs.meta new file mode 100644 index 000000000..8e71e1d73 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Dot.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c9c233b5173aece4493146b736d4e65d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Dot.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetMagnitude.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetMagnitude.cs new file mode 100644 index 000000000..b799ac128 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetMagnitude.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2 +{ + [TaskCategory("Unity/Vector2")] + [TaskDescription("Stores the magnitude of the Vector2.")] + public class GetMagnitude : Action + { + [Tooltip("The Vector2 to get the magnitude of")] + public SharedVector2 vector2Variable; + [Tooltip("The magnitude of the vector")] + [RequiredField] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = vector2Variable.Value.magnitude; + return TaskStatus.Success; + } + + public override void OnReset() + { + vector2Variable = Vector2.zero; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetMagnitude.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetMagnitude.cs.meta new file mode 100644 index 000000000..345c6f15c --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetMagnitude.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 64a63651c7294144197858c8b6387b49 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetMagnitude.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetRightVector.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetRightVector.cs new file mode 100644 index 000000000..f9ba29ced --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetRightVector.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2 +{ + [TaskCategory("Unity/Vector2")] + [TaskDescription("Stores the right vector value.")] + public class GetRightVector : Action + { + [Tooltip("The stored result")] + [RequiredField] + public SharedVector2 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector2.right; + return TaskStatus.Success; + } + + public override void OnReset() + { + storeResult = Vector2.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetRightVector.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetRightVector.cs.meta new file mode 100644 index 000000000..76732eea1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetRightVector.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f46062197c393bb4a809f7faf8e9fc70 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetRightVector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetSqrMagnitude.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetSqrMagnitude.cs new file mode 100644 index 000000000..69ac61650 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetSqrMagnitude.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2 +{ + [TaskCategory("Unity/Vector2")] + [TaskDescription("Stores the square magnitude of the Vector2.")] + public class GetSqrMagnitude : Action + { + [Tooltip("The Vector2 to get the square magnitude of")] + public SharedVector2 vector2Variable; + [Tooltip("The square magnitude of the vector")] + [RequiredField] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = vector2Variable.Value.sqrMagnitude; + return TaskStatus.Success; + } + + public override void OnReset() + { + vector2Variable = Vector2.zero; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetSqrMagnitude.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetSqrMagnitude.cs.meta new file mode 100644 index 000000000..1e95fdf46 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetSqrMagnitude.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5366ccb4258ea7f49ae280d05d2a195c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetSqrMagnitude.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetUpVector.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetUpVector.cs new file mode 100644 index 000000000..9e5986620 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetUpVector.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2 +{ + [TaskCategory("Unity/Vector2")] + [TaskDescription("Stores the up vector value.")] + public class GetUpVector : Action + { + [Tooltip("The stored result")] + [RequiredField] + public SharedVector2 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector2.up; + return TaskStatus.Success; + } + + public override void OnReset() + { + storeResult = Vector2.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetUpVector.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetUpVector.cs.meta new file mode 100644 index 000000000..f7d34f952 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetUpVector.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7ec54e34058d3a04dbd9ed27538731b0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetUpVector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetVector3.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetVector3.cs new file mode 100644 index 000000000..929884fb1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetVector3.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2 +{ + [TaskCategory("Unity/Vector2")] + [TaskDescription("Stores the Vector3 value of the Vector2.")] + public class GetVector3 : Action + { + [Tooltip("The Vector2 to get the Vector3 value of")] + public SharedVector2 vector3Variable; + [Tooltip("The Vector3 value")] + [RequiredField] + public SharedVector3 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = vector3Variable.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + vector3Variable = Vector2.zero; + storeResult = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetVector3.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetVector3.cs.meta new file mode 100644 index 000000000..291da8628 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetVector3.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 89ba2f45bfecb9c40a4de0394c8019e0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetVector3.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetXY.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetXY.cs new file mode 100644 index 000000000..154d5fc86 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetXY.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2 +{ + [TaskCategory("Unity/Vector2")] + [TaskDescription("Stores the X and Y values of the Vector2.")] + public class GetXY : Action + { + [Tooltip("The Vector2 to get the values of")] + public SharedVector2 vector2Variable; + [Tooltip("The X value")] + [RequiredField] + public SharedFloat storeX; + [Tooltip("The Y value")] + [RequiredField] + public SharedFloat storeY; + + public override TaskStatus OnUpdate() + { + storeX.Value = vector2Variable.Value.x; + storeY.Value = vector2Variable.Value.y; + return TaskStatus.Success; + } + + public override void OnReset() + { + vector2Variable = Vector2.zero; + storeX = storeY = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetXY.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetXY.cs.meta new file mode 100644 index 000000000..bff9f5cf9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetXY.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e258a57c9873ecf4fb8a1432e418ecb4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/GetXY.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Lerp.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Lerp.cs new file mode 100644 index 000000000..81919fe22 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Lerp.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2 +{ + [TaskCategory("Unity/Vector2")] + [TaskDescription("Lerp the Vector2 by an amount.")] + public class Lerp : Action + { + [Tooltip("The from value")] + public SharedVector2 fromVector2; + [Tooltip("The to value")] + public SharedVector2 toVector2; + [Tooltip("The amount to lerp")] + public SharedFloat lerpAmount; + [Tooltip("The lerp resut")] + [RequiredField] + public SharedVector2 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector2.Lerp(fromVector2.Value, toVector2.Value, lerpAmount.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + fromVector2 = Vector2.zero; + toVector2 = Vector2.zero; + storeResult = Vector2.zero; + lerpAmount = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Lerp.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Lerp.cs.meta new file mode 100644 index 000000000..137631a92 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Lerp.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6f709035ad060c04d9f758980ad7e2c3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Lerp.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/MoveTowards.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/MoveTowards.cs new file mode 100644 index 000000000..1d17e4764 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/MoveTowards.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2 +{ + [TaskCategory("Unity/Vector2")] + [TaskDescription("Move from the current position to the target position.")] + public class MoveTowards : Action + { + [Tooltip("The current position")] + public SharedVector2 currentPosition; + [Tooltip("The target position")] + public SharedVector2 targetPosition; + [Tooltip("The movement speed")] + public SharedFloat speed; + [Tooltip("The move resut")] + [RequiredField] + public SharedVector2 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector2.MoveTowards(currentPosition.Value, targetPosition.Value, speed.Value * Time.deltaTime); + return TaskStatus.Success; + } + + public override void OnReset() + { + currentPosition = Vector2.zero; + targetPosition = Vector2.zero; + storeResult = Vector2.zero; + speed = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/MoveTowards.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/MoveTowards.cs.meta new file mode 100644 index 000000000..4e0f113b7 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/MoveTowards.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ab464382cafa087498bef68f6988dff7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/MoveTowards.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Multiply.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Multiply.cs new file mode 100644 index 000000000..82bb7bf98 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Multiply.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2 +{ + [TaskCategory("Unity/Vector2")] + [TaskDescription("Multiply the Vector2 by a float.")] + public class Multiply : Action + { + [Tooltip("The Vector2 to multiply of")] + public SharedVector2 vector2Variable; + [Tooltip("The value to multiply the Vector2 of")] + public SharedFloat multiplyBy; + [Tooltip("The multiplication resut")] + [RequiredField] + public SharedVector2 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = vector2Variable.Value * multiplyBy.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + vector2Variable = storeResult = Vector2.zero; + multiplyBy = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Multiply.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Multiply.cs.meta new file mode 100644 index 000000000..fbf829bbc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Multiply.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7f21148eaa498684baa11ac8ac177599 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Multiply.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Normalize.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Normalize.cs new file mode 100644 index 000000000..da1440ecb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Normalize.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2 +{ + [TaskCategory("Unity/Vector2")] + [TaskDescription("Normalize the Vector2.")] + public class Normalize : Action + { + [Tooltip("The Vector2 to normalize")] + public SharedVector2 vector2Variable; + [Tooltip("The normalized resut")] + [RequiredField] + public SharedVector2 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = vector2Variable.Value.normalized; + return TaskStatus.Success; + } + + public override void OnReset() + { + vector2Variable = Vector2.zero; + storeResult = Vector2.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Normalize.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Normalize.cs.meta new file mode 100644 index 000000000..842e22e06 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Normalize.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ed5b59611a512984f9755c358afc67d8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Normalize.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Operator.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Operator.cs new file mode 100644 index 000000000..0af22caac --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Operator.cs @@ -0,0 +1,49 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2 +{ + [TaskCategory("Unity/Vector2")] + [TaskDescription("Performs a math operation on two Vector2s: Add, Subtract, Multiply, Divide, Min, or Max.")] + public class Operator : Action + { + public enum Operation + { + Add, + Subtract, + Scale + } + + [Tooltip("The operation to perform")] + public Operation operation; + [Tooltip("The first Vector2")] + public SharedVector2 firstVector2; + [Tooltip("The second Vector2")] + public SharedVector2 secondVector2; + [Tooltip("The variable to store the result")] + public SharedVector2 storeResult; + + public override TaskStatus OnUpdate() + { + switch (operation) { + case Operation.Add: + storeResult.Value = firstVector2.Value + secondVector2.Value; + break; + case Operation.Subtract: + storeResult.Value = firstVector2.Value - secondVector2.Value; + break; + case Operation.Scale: + storeResult.Value = Vector2.Scale(firstVector2.Value, secondVector2.Value); + break; + } + return TaskStatus.Success; + } + + public override void OnReset() + { + operation = Operation.Add; + firstVector2 = Vector2.zero; + secondVector2 = Vector2.zero; + storeResult = Vector2.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Operator.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Operator.cs.meta new file mode 100644 index 000000000..462fd3adc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Operator.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2ae8ac6f41714174fa63df41c7e32019 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/Operator.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/SetValue.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/SetValue.cs new file mode 100644 index 000000000..246c155cc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/SetValue.cs @@ -0,0 +1,26 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2 +{ + [TaskCategory("Unity/Vector2")] + [TaskDescription("Sets the value of the Vector2.")] + public class SetValue : Action + { + [Tooltip("The Vector2 to get the values of")] + public SharedVector2 vector2Value; + [Tooltip("The Vector2 to set the values of")] + public SharedVector2 vector2Variable; + + public override TaskStatus OnUpdate() + { + vector2Variable.Value = vector2Value.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + vector2Value = Vector2.zero; + vector2Variable = Vector2.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/SetValue.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/SetValue.cs.meta new file mode 100644 index 000000000..54ee544cb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/SetValue.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 61e3d384c43977148b829dab4090ab3b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/SetValue.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/SetXY.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/SetXY.cs new file mode 100644 index 000000000..f6c23d0d4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/SetXY.cs @@ -0,0 +1,36 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2 +{ + [TaskCategory("Unity/Vector2")] + [TaskDescription("Sets the X and Y values of the Vector2.")] + public class SetXY : Action + { + [Tooltip("The Vector2 to set the values of")] + public SharedVector2 vector2Variable; + [Tooltip("The X value. Set to None to have the value ignored")] + public SharedFloat xValue; + [Tooltip("The Y value. Set to None to have the value ignored")] + public SharedFloat yValue; + + public override TaskStatus OnUpdate() + { + var vector2Value = vector2Variable.Value; + if (!xValue.IsNone) { + vector2Value.x = xValue.Value; + } + if (!yValue.IsNone) { + vector2Value.y = yValue.Value; + } + vector2Variable.Value = vector2Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + vector2Variable = Vector2.zero; + xValue = 0; + yValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/SetXY.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/SetXY.cs.meta new file mode 100644 index 000000000..d6151e2cc --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/SetXY.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a24836a22bca9bd4ab701e35bf36f6a9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector2/SetXY.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3.meta new file mode 100644 index 000000000..1dea60080 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 65391955a7357ef4e82aa0214dc9b407 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Angle.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Angle.cs new file mode 100644 index 000000000..054c9c2f3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Angle.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Returns the angle between two Vector3s.")] + public class Angle : Action + { + [Tooltip("The first Vector3")] + public SharedVector3 firstVector3; + [Tooltip("The second Vector3")] + public SharedVector3 secondVector3; + [Tooltip("The angle")] + [RequiredField] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector3.Angle(firstVector3.Value, secondVector3.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + firstVector3 = Vector3.zero; + secondVector3 = Vector3.zero; + storeResult = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Angle.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Angle.cs.meta new file mode 100644 index 000000000..9e56f41df --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Angle.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1e3b18a7f2f7db54992b881f449091ad +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Angle.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/ClampMagnitude.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/ClampMagnitude.cs new file mode 100644 index 000000000..9795cdcae --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/ClampMagnitude.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Clamps the magnitude of the Vector3.")] + public class ClampMagnitude : Action + { + [Tooltip("The Vector3 to clamp the magnitude of")] + public SharedVector3 vector3Variable; + [Tooltip("The max length of the magnitude")] + public SharedFloat maxLength; + [Tooltip("The clamp magnitude resut")] + [RequiredField] + public SharedVector3 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector3.ClampMagnitude(vector3Variable.Value, maxLength.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + vector3Variable = Vector3.zero; + storeResult = Vector3.zero; + maxLength = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/ClampMagnitude.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/ClampMagnitude.cs.meta new file mode 100644 index 000000000..00a0e3dec --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/ClampMagnitude.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e3d2efd14a9499b47a17ea16bf45512f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/ClampMagnitude.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Distance.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Distance.cs new file mode 100644 index 000000000..2266cf266 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Distance.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Returns the distance between two Vector3s.")] + public class Distance : Action + { + [Tooltip("The first Vector3")] + public SharedVector3 firstVector3; + [Tooltip("The second Vector3")] + public SharedVector3 secondVector3; + [Tooltip("The distance")] + [RequiredField] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector3.Distance(firstVector3.Value, secondVector3.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + firstVector3 = Vector3.zero; + secondVector3 = Vector3.zero; + storeResult = 0; + } + } +} diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Distance.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Distance.cs.meta new file mode 100644 index 000000000..b49966abd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Distance.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8c4522b996b52d040822fb808cfc9d97 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Distance.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Dot.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Dot.cs new file mode 100644 index 000000000..b68ea0409 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Dot.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Stores the dot product of two Vector3 values.")] + public class Dot : Action + { + [Tooltip("The left hand side of the dot product")] + public SharedVector3 leftHandSide; + [Tooltip("The right hand side of the dot product")] + public SharedVector3 rightHandSide; + [Tooltip("The dot product result")] + [RequiredField] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector3.Dot(leftHandSide.Value, rightHandSide.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + leftHandSide = Vector3.zero; + rightHandSide = Vector3.zero; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Dot.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Dot.cs.meta new file mode 100644 index 000000000..a3ce3459d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Dot.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fe5e2655abffbe94eba3f6a0abd34b5c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Dot.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetForwardVector.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetForwardVector.cs new file mode 100644 index 000000000..eee7e008e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetForwardVector.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Stores the forward vector value.")] + public class GetForwardVector : Action + { + [Tooltip("The stored result")] + [RequiredField] + public SharedVector3 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector3.forward; + return TaskStatus.Success; + } + + public override void OnReset() + { + storeResult = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetForwardVector.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetForwardVector.cs.meta new file mode 100644 index 000000000..c4147c5fb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetForwardVector.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b09c11f987794eb45b65e0ef249cdb3f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetForwardVector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetMagnitude.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetMagnitude.cs new file mode 100644 index 000000000..5a7c5165a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetMagnitude.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Stores the magnitude of the Vector3.")] + public class GetMagnitude : Action + { + [Tooltip("The Vector3 to get the magnitude of")] + public SharedVector3 vector3Variable; + [Tooltip("The magnitude of the vector")] + [RequiredField] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = vector3Variable.Value.magnitude; + return TaskStatus.Success; + } + + public override void OnReset() + { + vector3Variable = Vector3.zero; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetMagnitude.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetMagnitude.cs.meta new file mode 100644 index 000000000..4eddf6d8e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetMagnitude.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: dcf2397966692fe4a819a0db18186778 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetMagnitude.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetRightVector.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetRightVector.cs new file mode 100644 index 000000000..7e496020f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetRightVector.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Stores the right vector value.")] + public class GetRightVector : Action + { + [Tooltip("The stored result")] + [RequiredField] + public SharedVector3 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector3.right; + return TaskStatus.Success; + } + + public override void OnReset() + { + storeResult = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetRightVector.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetRightVector.cs.meta new file mode 100644 index 000000000..800cc1933 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetRightVector.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ca338b1189144fe47ab9b1fa6a54e970 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetRightVector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetSqrMagnitude.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetSqrMagnitude.cs new file mode 100644 index 000000000..92dfeb250 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetSqrMagnitude.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Stores the square magnitude of the Vector3.")] + public class GetSqrMagnitude : Action + { + [Tooltip("The Vector3 to get the square magnitude of")] + public SharedVector3 vector3Variable; + [Tooltip("The square magnitude of the vector")] + [RequiredField] + public SharedFloat storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = vector3Variable.Value.sqrMagnitude; + return TaskStatus.Success; + } + + public override void OnReset() + { + vector3Variable = Vector3.zero; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetSqrMagnitude.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetSqrMagnitude.cs.meta new file mode 100644 index 000000000..74a565d7e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetSqrMagnitude.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fb704714eacb92948bd59ddd38865b59 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetSqrMagnitude.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetUpVector.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetUpVector.cs new file mode 100644 index 000000000..95fa362e0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetUpVector.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Stores the up vector value.")] + public class GetUpVector : Action + { + [Tooltip("The stored result")] + [RequiredField] + public SharedVector3 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector3.up; + return TaskStatus.Success; + } + + public override void OnReset() + { + storeResult = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetUpVector.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetUpVector.cs.meta new file mode 100644 index 000000000..c42a8d27a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetUpVector.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 225a4566a02bdec4e82a2335b4e6c5fc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetUpVector.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetVector2.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetVector2.cs new file mode 100644 index 000000000..ef9230014 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetVector2.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Stores the Vector2 value of the Vector3.")] + public class GetVector2 : Action + { + [Tooltip("The Vector3 to get the Vector2 value of")] + public SharedVector3 vector3Variable; + [Tooltip("The Vector2 value")] + [RequiredField] + public SharedVector2 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = vector3Variable.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + vector3Variable = Vector3.zero; + storeResult = Vector2.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetVector2.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetVector2.cs.meta new file mode 100644 index 000000000..3b63b7b09 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetVector2.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 959ed107c681b1c44af1b842ed7ca445 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetVector2.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetXYZ.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetXYZ.cs new file mode 100644 index 000000000..56307e99d --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetXYZ.cs @@ -0,0 +1,37 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Stores the X, Y, and Z values of the Vector3.")] + public class GetXYZ : Action + { + [Tooltip("The Vector3 to get the values of")] + public SharedVector3 vector3Variable; + [Tooltip("The X value")] + [RequiredField] + public SharedFloat storeX; + [Tooltip("The Y value")] + [RequiredField] + public SharedFloat storeY; + [Tooltip("The Z value")] + [RequiredField] + public SharedFloat storeZ; + + public override TaskStatus OnUpdate() + { + storeX.Value = vector3Variable.Value.x; + storeY.Value = vector3Variable.Value.y; + storeZ.Value = vector3Variable.Value.z; + return TaskStatus.Success; + } + + public override void OnReset() + { + vector3Variable = Vector3.zero; + storeX = 0; + storeY = 0; + storeZ = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetXYZ.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetXYZ.cs.meta new file mode 100644 index 000000000..c740ed119 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetXYZ.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fbab043af227fe14e8875a1df65cbae4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/GetXYZ.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Lerp.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Lerp.cs new file mode 100644 index 000000000..e939878c0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Lerp.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Lerp the Vector3 by an amount.")] + public class Lerp : Action + { + [Tooltip("The from value")] + public SharedVector3 fromVector3; + [Tooltip("The to value")] + public SharedVector3 toVector3; + [Tooltip("The amount to lerp")] + public SharedFloat lerpAmount; + [Tooltip("The lerp resut")] + [RequiredField] + public SharedVector3 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector3.Lerp(fromVector3.Value, toVector3.Value, lerpAmount.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + fromVector3 = toVector3 = storeResult = Vector3.zero; + lerpAmount = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Lerp.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Lerp.cs.meta new file mode 100644 index 000000000..608074e62 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Lerp.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ef769062529820342a12a00e9cf8611d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Lerp.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/MoveTowards.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/MoveTowards.cs new file mode 100644 index 000000000..b082f2008 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/MoveTowards.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Move from the current position to the target position.")] + public class MoveTowards : Action + { + [Tooltip("The current position")] + public SharedVector3 currentPosition; + [Tooltip("The target position")] + public SharedVector3 targetPosition; + [Tooltip("The movement speed")] + public SharedFloat speed; + [Tooltip("The move resut")] + [RequiredField] + public SharedVector3 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector3.MoveTowards(currentPosition.Value, targetPosition.Value, speed.Value * Time.deltaTime); + return TaskStatus.Success; + } + + public override void OnReset() + { + currentPosition = Vector3.zero; + targetPosition = Vector3.zero; + storeResult = Vector3.zero; + speed = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/MoveTowards.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/MoveTowards.cs.meta new file mode 100644 index 000000000..f2b433976 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/MoveTowards.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b6562a7b02f6ab1478612f41defc5299 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/MoveTowards.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Multiply.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Multiply.cs new file mode 100644 index 000000000..880415696 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Multiply.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Multiply the Vector3 by a float.")] + public class Multiply : Action + { + [Tooltip("The Vector3 to multiply of")] + public SharedVector3 vector3Variable; + [Tooltip("The value to multiply the Vector3 of")] + public SharedFloat multiplyBy; + [Tooltip("The multiplication resut")] + [RequiredField] + public SharedVector3 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = vector3Variable.Value * multiplyBy.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + vector3Variable = Vector3.zero; + storeResult = Vector3.zero; + multiplyBy = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Multiply.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Multiply.cs.meta new file mode 100644 index 000000000..bceba5169 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Multiply.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1d1d7bd2678e229468abd363ac4a3dd6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Multiply.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Normalize.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Normalize.cs new file mode 100644 index 000000000..6d03c73a7 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Normalize.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Normalize the Vector3.")] + public class Normalize : Action + { + [Tooltip("The Vector3 to normalize")] + public SharedVector3 vector3Variable; + [Tooltip("The normalized resut")] + [RequiredField] + public SharedVector3 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector3.Normalize(vector3Variable.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + vector3Variable = Vector3.zero; + storeResult = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Normalize.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Normalize.cs.meta new file mode 100644 index 000000000..aa6ea4373 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Normalize.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: bc8d58dc29ef6ab49a11e77f517e30ca +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Normalize.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Operator.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Operator.cs new file mode 100644 index 000000000..64f6dfdba --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Operator.cs @@ -0,0 +1,49 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Performs a math operation on two Vector3s: Add, Subtract, Multiply, Divide, Min, or Max.")] + public class Operator : Action + { + public enum Operation + { + Add, + Subtract, + Scale + } + + [Tooltip("The operation to perform")] + public Operation operation; + [Tooltip("The first Vector3")] + public SharedVector3 firstVector3; + [Tooltip("The second Vector3")] + public SharedVector3 secondVector3; + [Tooltip("The variable to store the result")] + public SharedVector3 storeResult; + + public override TaskStatus OnUpdate() + { + switch (operation) { + case Operation.Add: + storeResult.Value = firstVector3.Value + secondVector3.Value; + break; + case Operation.Subtract: + storeResult.Value = firstVector3.Value - secondVector3.Value; + break; + case Operation.Scale: + storeResult.Value = Vector3.Scale(firstVector3.Value, secondVector3.Value); + break; + } + return TaskStatus.Success; + } + + public override void OnReset() + { + operation = Operation.Add; + firstVector3 = Vector3.zero; + secondVector3 = Vector3.zero; + storeResult = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Operator.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Operator.cs.meta new file mode 100644 index 000000000..7b4d56930 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Operator.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 606d84afee1cfbe4892d452884d36be8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/Operator.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/RotateTowards.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/RotateTowards.cs new file mode 100644 index 000000000..72e1f5c8e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/RotateTowards.cs @@ -0,0 +1,36 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Rotate the current rotation to the target rotation.")] + public class RotateTowards : Action + { + [Tooltip("The current rotation in euler angles")] + public SharedVector3 currentRotation; + [Tooltip("The target rotation in euler angles")] + public SharedVector3 targetRotation; + [Tooltip("The maximum delta of the degrees")] + public SharedFloat maxDegreesDelta; + [Tooltip("The maximum delta of the magnitude")] + public SharedFloat maxMagnitudeDelta; + [Tooltip("The rotation resut")] + [RequiredField] + public SharedVector3 storeResult; + + public override TaskStatus OnUpdate() + { + storeResult.Value = Vector3.RotateTowards(currentRotation.Value, targetRotation.Value, maxDegreesDelta.Value * Mathf.Deg2Rad * Time.deltaTime, maxMagnitudeDelta.Value); + return TaskStatus.Success; + } + + public override void OnReset() + { + currentRotation = Vector3.zero; + targetRotation = Vector3.zero; + storeResult = Vector3.zero; + maxDegreesDelta = 0; + maxMagnitudeDelta = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/RotateTowards.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/RotateTowards.cs.meta new file mode 100644 index 000000000..9865875c6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/RotateTowards.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 55175ed9420ee88429fbb91a9b433b9c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/RotateTowards.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/SetValue.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/SetValue.cs new file mode 100644 index 000000000..194fa6e98 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/SetValue.cs @@ -0,0 +1,26 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Sets the value of the Vector3.")] + public class SetValue : Action + { + [Tooltip("The Vector3 to get the values of")] + public SharedVector3 vector3Value; + [Tooltip("The Vector3 to set the values of")] + public SharedVector3 vector3Variable; + + public override TaskStatus OnUpdate() + { + vector3Variable.Value = vector3Value.Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + vector3Value = Vector3.zero; + vector3Variable = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/SetValue.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/SetValue.cs.meta new file mode 100644 index 000000000..2233f892a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/SetValue.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d512a8eb2bde4ea49868fdd746dafb0d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/SetValue.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/SetXYZ.cs b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/SetXYZ.cs new file mode 100644 index 000000000..23d05a0da --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/SetXYZ.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3 +{ + [TaskCategory("Unity/Vector3")] + [TaskDescription("Sets the X, Y, and Z values of the Vector3.")] + public class SetXYZ : Action + { + [Tooltip("The Vector3 to set the values of")] + public SharedVector3 vector3Variable; + [Tooltip("The X value. Set to None to have the value ignored")] + public SharedFloat xValue; + [Tooltip("The Y value. Set to None to have the value ignored")] + public SharedFloat yValue; + [Tooltip("The Z value. Set to None to have the value ignored")] + public SharedFloat zValue; + + public override TaskStatus OnUpdate() + { + var vector3Value = vector3Variable.Value; + if (!xValue.IsNone) { + vector3Value.x = xValue.Value; + } + if (!yValue.IsNone) { + vector3Value.y = yValue.Value; + } + if (!zValue.IsNone) { + vector3Value.z = zValue.Value; + } + vector3Variable.Value = vector3Value; + return TaskStatus.Success; + } + + public override void OnReset() + { + vector3Variable = Vector3.zero; + xValue = yValue = zValue = 0; + } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/SetXYZ.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/SetXYZ.cs.meta new file mode 100644 index 000000000..823ddda91 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/SetXYZ.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: efcd4530935b0c445804e64d0820f27b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Tasks/Unity/Vector3/SetXYZ.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables.meta new file mode 100644 index 000000000..c91b795e3 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a52d5a185c5a1614f875fcb1828d78d8 +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedAnimationCurve.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedAnimationCurve.cs new file mode 100644 index 000000000..f7c8a6de5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedAnimationCurve.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedAnimationCurve : SharedVariable + { + public static implicit operator SharedAnimationCurve(AnimationCurve value) { return new SharedAnimationCurve { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedAnimationCurve.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedAnimationCurve.cs.meta new file mode 100644 index 000000000..b141bc4b6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedAnimationCurve.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e30f25f7530f8424a997bd05af4ef4fd +timeCreated: 1500510014 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedAnimationCurve.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedBehaviour.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedBehaviour.cs new file mode 100644 index 000000000..e896be7c4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedBehaviour.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedBehaviour : SharedVariable + { + public static explicit operator SharedBehaviour(Behaviour value) { return new SharedBehaviour { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedBehaviour.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedBehaviour.cs.meta new file mode 100644 index 000000000..e329aeddd --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedBehaviour.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 30ee055ba23074141b455674e2e17bff +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedBehaviour.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedBool.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedBool.cs new file mode 100644 index 000000000..233470f81 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedBool.cs @@ -0,0 +1,8 @@ +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedBool : SharedVariable + { + public static implicit operator SharedBool(bool value) { return new SharedBool { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedBool.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedBool.cs.meta new file mode 100644 index 000000000..66a5e31bb --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedBool.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c2f4e02925f3d454c8a49a9f9cc1d497 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedBool.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedCollider.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedCollider.cs new file mode 100644 index 000000000..9311dc4c1 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedCollider.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedCollider : SharedVariable + { + public static implicit operator SharedCollider(Collider value) { return new SharedCollider { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedCollider.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedCollider.cs.meta new file mode 100644 index 000000000..8ac9e0f1a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedCollider.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9e04c1684b0b8b7439be44cc63a4d5f2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedCollider.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedColor.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedColor.cs new file mode 100644 index 000000000..7a893ab34 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedColor.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedColor : SharedVariable + { + public static implicit operator SharedColor(Color value) { return new SharedColor { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedColor.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedColor.cs.meta new file mode 100644 index 000000000..3cc13de02 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedColor.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1aebb6343767438449d67bf4118aeefe +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedColor.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedFloat.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedFloat.cs new file mode 100644 index 000000000..465595909 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedFloat.cs @@ -0,0 +1,8 @@ +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedFloat : SharedVariable + { + public static implicit operator SharedFloat(float value) { return new SharedFloat { Value = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedFloat.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedFloat.cs.meta new file mode 100644 index 000000000..18d741ca6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedFloat.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 954735ce9c49fd845add7abd7883211c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedFloat.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedGameObject.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedGameObject.cs new file mode 100644 index 000000000..1347a43ab --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedGameObject.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedGameObject : SharedVariable + { + public static implicit operator SharedGameObject(GameObject value) { return new SharedGameObject { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedGameObject.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedGameObject.cs.meta new file mode 100644 index 000000000..475222b0f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedGameObject.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: df84e4f8f0e526344a46be1b083e0218 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedGameObject.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedGameObjectList.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedGameObjectList.cs new file mode 100644 index 000000000..638a10d92 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedGameObjectList.cs @@ -0,0 +1,16 @@ +using UnityEngine; +using System.Collections.Generic; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedGameObjectList : SharedVariable> + { + public SharedGameObjectList() + { + mValue = new List(); + } + + public static implicit operator SharedGameObjectList(List value) { return new SharedGameObjectList { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedGameObjectList.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedGameObjectList.cs.meta new file mode 100644 index 000000000..061056619 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedGameObjectList.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 70650d45c2fa6794a9fdd7d2a74bb59a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedGameObjectList.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedHumanBodyBones.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedHumanBodyBones.cs new file mode 100644 index 000000000..207ffa665 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedHumanBodyBones.cs @@ -0,0 +1,8 @@ +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedHumanBodyBones : SharedVariable + { + public static implicit operator SharedHumanBodyBones(UnityEngine.HumanBodyBones value) { return new SharedHumanBodyBones { Value = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedHumanBodyBones.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedHumanBodyBones.cs.meta new file mode 100644 index 000000000..8c5b13fb9 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedHumanBodyBones.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 150c45a094adbb54c90e721a86180763 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedHumanBodyBones.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedInt.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedInt.cs new file mode 100644 index 000000000..6b5229c7b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedInt.cs @@ -0,0 +1,8 @@ +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedInt : SharedVariable + { + public static implicit operator SharedInt(int value) { return new SharedInt { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedInt.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedInt.cs.meta new file mode 100644 index 000000000..c34ba3292 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedInt.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 00de328b40e8ac84ebf75e48fe353f38 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedInt.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedLayerMask.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedLayerMask.cs new file mode 100644 index 000000000..3701e7ba5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedLayerMask.cs @@ -0,0 +1,8 @@ +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedLayerMask : SharedVariable + { + public static implicit operator SharedLayerMask(UnityEngine.LayerMask value) { return new SharedLayerMask { Value = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedLayerMask.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedLayerMask.cs.meta new file mode 100644 index 000000000..e6a0d516a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedLayerMask.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 86ff0dd68e1e479408158dfe30d4258f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedLayerMask.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedMaterial.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedMaterial.cs new file mode 100644 index 000000000..31813e469 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedMaterial.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedMaterial : SharedVariable + { + public static implicit operator SharedMaterial(Material value) { return new SharedMaterial { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedMaterial.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedMaterial.cs.meta new file mode 100644 index 000000000..3fc12598f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedMaterial.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2e84514e0f685a64795ecdb776888407 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedMaterial.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedObject.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedObject.cs new file mode 100644 index 000000000..8d948cc49 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedObject.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedObject : SharedVariable + { + public static explicit operator SharedObject(Object value) { return new SharedObject { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedObject.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedObject.cs.meta new file mode 100644 index 000000000..801c8267e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedObject.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d5ffddfc2d65c6e4ca1dedda5afd6ccc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedObject.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedObjectList.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedObjectList.cs new file mode 100644 index 000000000..c20f8d0ea --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedObjectList.cs @@ -0,0 +1,11 @@ +using UnityEngine; +using System.Collections.Generic; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedObjectList : SharedVariable> + { + public static implicit operator SharedObjectList(List value) { return new SharedObjectList { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedObjectList.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedObjectList.cs.meta new file mode 100644 index 000000000..48f90acf0 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedObjectList.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c7644e981f746b5458fb6adbda412b2d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedObjectList.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedQuaternion.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedQuaternion.cs new file mode 100644 index 000000000..217bd707e --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedQuaternion.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedQuaternion : SharedVariable + { + public static implicit operator SharedQuaternion(Quaternion value) { return new SharedQuaternion { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedQuaternion.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedQuaternion.cs.meta new file mode 100644 index 000000000..545fe3508 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedQuaternion.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1ec5ca504fe011b449506c42d3e5ac7f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedQuaternion.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedRect.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedRect.cs new file mode 100644 index 000000000..3e026fcf5 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedRect.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedRect : SharedVariable + { + public static implicit operator SharedRect(Rect value) { return new SharedRect { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedRect.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedRect.cs.meta new file mode 100644 index 000000000..2dc0944db --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedRect.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 23ef607e9df5ab742afbea152c79eed5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedRect.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedString.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedString.cs new file mode 100644 index 000000000..ae9974672 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedString.cs @@ -0,0 +1,8 @@ +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedString : SharedVariable + { + public static implicit operator SharedString(string value) { return new SharedString { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedString.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedString.cs.meta new file mode 100644 index 000000000..a6931fb14 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedString.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2b562573ea4266848bc3f78352dca3a5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedString.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedTransform.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedTransform.cs new file mode 100644 index 000000000..ac12b573a --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedTransform.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedTransform : SharedVariable + { + public static implicit operator SharedTransform(Transform value) { return new SharedTransform { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedTransform.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedTransform.cs.meta new file mode 100644 index 000000000..e9fd21023 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedTransform.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3e084053b0dbe6541bc2408005c85606 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedTransform.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedTransformList.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedTransformList.cs new file mode 100644 index 000000000..9dc315879 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedTransformList.cs @@ -0,0 +1,16 @@ +using UnityEngine; +using System.Collections.Generic; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedTransformList : SharedVariable> + { + public SharedTransformList() + { + mValue = new List(); + } + + public static implicit operator SharedTransformList(List value) { return new SharedTransformList { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedTransformList.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedTransformList.cs.meta new file mode 100644 index 000000000..9229fc69f --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedTransformList.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 11f38abc81b11804aabe69ae80011a60 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedTransformList.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedUInt.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedUInt.cs new file mode 100644 index 000000000..cd8129769 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedUInt.cs @@ -0,0 +1,8 @@ +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedUInt : SharedVariable + { + public static implicit operator SharedUInt(uint value) { return new SharedUInt { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedUInt.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedUInt.cs.meta new file mode 100644 index 000000000..3a3f9aada --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedUInt.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f63201b0b2f3043409fc893c5556cd35 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedUInt.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector2.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector2.cs new file mode 100644 index 000000000..46d0b3093 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector2.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedVector2 : SharedVariable + { + public static implicit operator SharedVector2(Vector2 value) { return new SharedVector2 { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector2.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector2.cs.meta new file mode 100644 index 000000000..6ee688a46 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector2.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2398d4531b638134384482dcac3e850c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedVector2.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector2Int.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector2Int.cs new file mode 100644 index 000000000..85b1bcd64 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector2Int.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedVector2Int : SharedVariable + { + public static implicit operator SharedVector2Int(Vector2Int value) { return new SharedVector2Int { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector2Int.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector2Int.cs.meta new file mode 100644 index 000000000..752866bf4 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector2Int.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 2030317e0987d01489996e3719960b2d +timeCreated: 1516763749 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedVector2Int.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector3.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector3.cs new file mode 100644 index 000000000..e78560ae6 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector3.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedVector3 : SharedVariable + { + public static implicit operator SharedVector3(Vector3 value) { return new SharedVector3 { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector3.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector3.cs.meta new file mode 100644 index 000000000..fea8da730 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector3.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2093670c041663d4096c217e7c790683 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedVector3.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector3Int.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector3Int.cs new file mode 100644 index 000000000..b811c173b --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector3Int.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedVector3Int : SharedVariable + { + public static implicit operator SharedVector3Int(Vector3Int value) { return new SharedVector3Int { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector3Int.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector3Int.cs.meta new file mode 100644 index 000000000..63b474059 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector3Int.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 6b50923655e14e64986162aa7f34d318 +timeCreated: 1516763759 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedVector3Int.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector4.cs b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector4.cs new file mode 100644 index 000000000..8d7d43950 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector4.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime +{ + [System.Serializable] + public class SharedVector4 : SharedVariable + { + public static implicit operator SharedVector4(Vector4 value) { return new SharedVector4 { mValue = value }; } + } +} \ No newline at end of file diff --git a/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector4.cs.meta b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector4.cs.meta new file mode 100644 index 000000000..b4d0ead02 --- /dev/null +++ b/BlueWater/Assets/Behavior Designer/Runtime/Variables/SharedVector4.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e12e4a2550a6e5f4aa39fdd59126ed66 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Behavior Designer/Runtime/Variables/SharedVector4.cs + uploadId: 598781 diff --git a/BlueWater/Assets/Gizmos.meta b/BlueWater/Assets/Gizmos.meta new file mode 100644 index 000000000..b0c759c07 --- /dev/null +++ b/BlueWater/Assets/Gizmos.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 83e68ef8a9fae1d478e2af0204db5f3f +DefaultImporter: + userData: diff --git a/BlueWater/Assets/Gizmos/Behavior Designer Hier Icon.png b/BlueWater/Assets/Gizmos/Behavior Designer Hier Icon.png new file mode 100644 index 000000000..1b4f933e7 Binary files /dev/null and b/BlueWater/Assets/Gizmos/Behavior Designer Hier Icon.png differ diff --git a/BlueWater/Assets/Gizmos/Behavior Designer Hier Icon.png.meta b/BlueWater/Assets/Gizmos/Behavior Designer Hier Icon.png.meta new file mode 100644 index 000000000..9f5d15123 --- /dev/null +++ b/BlueWater/Assets/Gizmos/Behavior Designer Hier Icon.png.meta @@ -0,0 +1,42 @@ +fileFormatVersion: 2 +guid: f011c2328e41d994b83d3c757e68904c +TextureImporter: + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + textureType: 2 + buildTargetSettings: [] + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Gizmos/Behavior Designer Hier Icon.png + uploadId: 598781 diff --git a/BlueWater/Assets/Gizmos/Behavior Designer Scene Icon.png b/BlueWater/Assets/Gizmos/Behavior Designer Scene Icon.png new file mode 100644 index 000000000..5e67cae4e Binary files /dev/null and b/BlueWater/Assets/Gizmos/Behavior Designer Scene Icon.png differ diff --git a/BlueWater/Assets/Gizmos/Behavior Designer Scene Icon.png.meta b/BlueWater/Assets/Gizmos/Behavior Designer Scene Icon.png.meta new file mode 100644 index 000000000..ade3bcb02 --- /dev/null +++ b/BlueWater/Assets/Gizmos/Behavior Designer Scene Icon.png.meta @@ -0,0 +1,42 @@ +fileFormatVersion: 2 +guid: 5b5f458971c6fd5459c51a7b8079bc3b +TextureImporter: + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + textureType: 2 + buildTargetSettings: [] + userData: +AssetOrigin: + serializedVersion: 1 + productId: 15277 + packageName: Behavior Designer - Behavior Trees for Everyone + packageVersion: 1.7.7p1 + assetPath: Assets/Gizmos/Behavior Designer Scene Icon.png + uploadId: 598781