summaryrefslogtreecommitdiff
path: root/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation')
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Blend.cs51
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Blend.cs.meta8
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/CrossFade.cs51
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/CrossFade.cs.meta8
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/CrossFadeQueued.cs54
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/CrossFadeQueued.cs.meta8
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/GetAnimatePhysics.cs46
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/GetAnimatePhysics.cs.meta8
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/IsPlaying.cs47
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/IsPlaying.cs.meta8
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Play.cs52
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Play.cs.meta8
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/PlayQueued.cs51
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/PlayQueued.cs.meta8
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Rewind.cs49
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Rewind.cs.meta8
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Sample.cs41
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Sample.cs.meta8
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/SetAnimatePhysics.cs45
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/SetAnimatePhysics.cs.meta8
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/SetWrapMode.cs45
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/SetWrapMode.cs.meta8
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Stop.cs49
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Stop.cs.meta8
24 files changed, 677 insertions, 0 deletions
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Blend.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Blend.cs
new file mode 100644
index 00000000..18b15029
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Blend.cs
@@ -0,0 +1,51 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAnimation
+{
+ [TaskCategory("Basic/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<Animation>();
+ 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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Blend.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Blend.cs.meta
new file mode 100644
index 00000000..191ac404
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Blend.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: dc0640154eb6b674e89f4a2ec1632696
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/CrossFade.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/CrossFade.cs
new file mode 100644
index 00000000..759ad6d8
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/CrossFade.cs
@@ -0,0 +1,51 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAnimation
+{
+ [TaskCategory("Basic/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 amount of time it takes to blend")]
+ public float 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<Animation>();
+ prevGameObject = currentGameObject;
+ }
+ }
+
+ public override TaskStatus OnUpdate()
+ {
+ if (animation == null) {
+ //Debug.LogWarning("Animation is null");
+ return TaskStatus.Failure;
+ }
+
+ animation.CrossFade(animationName.Value, fadeLength, playMode);
+
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ targetGameObject = null;
+ animationName.Value = "";
+ fadeLength = 0.3f;
+ playMode = PlayMode.StopSameLayer;
+ }
+ }
+} \ No newline at end of file
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/CrossFade.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/CrossFade.cs.meta
new file mode 100644
index 00000000..dd091e17
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/CrossFade.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 57d9d1509d13e454caae6f3219c83cc7
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/CrossFadeQueued.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/CrossFadeQueued.cs
new file mode 100644
index 00000000..67973730
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/CrossFadeQueued.cs
@@ -0,0 +1,54 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAnimation
+{
+ [TaskCategory("Basic/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<Animation>();
+ 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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/CrossFadeQueued.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/CrossFadeQueued.cs.meta
new file mode 100644
index 00000000..fda00b91
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/CrossFadeQueued.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c1cc2a160ee1978488696564200b3c25
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/GetAnimatePhysics.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/GetAnimatePhysics.cs
new file mode 100644
index 00000000..3d832dfd
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/GetAnimatePhysics.cs
@@ -0,0 +1,46 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAnimation
+{
+ [TaskCategory("Basic/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<Animation>();
+ 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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/GetAnimatePhysics.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/GetAnimatePhysics.cs.meta
new file mode 100644
index 00000000..4bb05d26
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/GetAnimatePhysics.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b5bd2b0ed07f42142934568bd6813619
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/IsPlaying.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/IsPlaying.cs
new file mode 100644
index 00000000..07b99732
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/IsPlaying.cs
@@ -0,0 +1,47 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAnimation
+{
+ [TaskCategory("Basic/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<Animation>();
+ 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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/IsPlaying.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/IsPlaying.cs.meta
new file mode 100644
index 00000000..ac35dc24
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/IsPlaying.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: ce80475167d230d4181baa69071465ff
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Play.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Play.cs
new file mode 100644
index 00000000..45c014b3
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Play.cs
@@ -0,0 +1,52 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAnimation
+{
+ [TaskCategory("Basic/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<Animation>();
+ 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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Play.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Play.cs.meta
new file mode 100644
index 00000000..b89dbdf0
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Play.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 0b1bf3b05e79dcc468cf71b63d54a4cd
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/PlayQueued.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/PlayQueued.cs
new file mode 100644
index 00000000..b6d7a543
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/PlayQueued.cs
@@ -0,0 +1,51 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAnimation
+{
+ [TaskCategory("Basic/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<Animation>();
+ 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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/PlayQueued.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/PlayQueued.cs.meta
new file mode 100644
index 00000000..5a578270
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/PlayQueued.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: bb55ee97bf8cb3d479de025d77a9c4b6
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Rewind.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Rewind.cs
new file mode 100644
index 00000000..f870f50f
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Rewind.cs
@@ -0,0 +1,49 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAnimation
+{
+ [TaskCategory("Basic/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<Animation>();
+ 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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Rewind.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Rewind.cs.meta
new file mode 100644
index 00000000..29a969f7
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Rewind.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 364beb9f6996556449b9f3e03db75290
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Sample.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Sample.cs
new file mode 100644
index 00000000..5b62e126
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Sample.cs
@@ -0,0 +1,41 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAnimation
+{
+ [TaskCategory("Basic/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<Animation>();
+ 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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Sample.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Sample.cs.meta
new file mode 100644
index 00000000..ebb26237
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Sample.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 2cc64c997b5d6e640af8cc9bd7cf1b5d
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/SetAnimatePhysics.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/SetAnimatePhysics.cs
new file mode 100644
index 00000000..584ad984
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/SetAnimatePhysics.cs
@@ -0,0 +1,45 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAnimation
+{
+ [TaskCategory("Basic/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<Animation>();
+ 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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/SetAnimatePhysics.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/SetAnimatePhysics.cs.meta
new file mode 100644
index 00000000..dda3f075
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/SetAnimatePhysics.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: f93fd0c7638add0468744d4f7249c1a7
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/SetWrapMode.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/SetWrapMode.cs
new file mode 100644
index 00000000..d17c4508
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/SetWrapMode.cs
@@ -0,0 +1,45 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAnimation
+{
+ [TaskCategory("Basic/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<Animation>();
+ 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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/SetWrapMode.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/SetWrapMode.cs.meta
new file mode 100644
index 00000000..7b815d1d
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/SetWrapMode.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 39af69a1e220fc2419a5d34933029ff9
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Stop.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Stop.cs
new file mode 100644
index 00000000..138de081
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Stop.cs
@@ -0,0 +1,49 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAnimation
+{
+ [TaskCategory("Basic/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<Animation>();
+ 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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Stop.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Stop.cs.meta
new file mode 100644
index 00000000..8edc170a
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Animation/Stop.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c3dca423f03e936449fdb622cac3f430
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData: