From 97da432c35b8c7aaf9dd2c39e2aa4b1f55f36065 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 27 Jan 2021 16:15:06 +0800 Subject: +behaviour designer --- .../AudioSource/GetIgnoreListenerPause.cs | 45 +++++++++++++++++++++ .../AudioSource/GetIgnoreListenerPause.cs.meta | 8 ++++ .../AudioSource/GetIgnoreListenerVolume.cs | 45 +++++++++++++++++++++ .../AudioSource/GetIgnoreListenerVolume.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/GetLoop.cs | 45 +++++++++++++++++++++ .../Basic Tasks/AudioSource/GetLoop.cs.meta | 8 ++++ .../Basic Tasks/AudioSource/GetMaxDistance.cs | 45 +++++++++++++++++++++ .../Basic Tasks/AudioSource/GetMaxDistance.cs.meta | 8 ++++ .../Basic Tasks/AudioSource/GetMinDistance.cs | 45 +++++++++++++++++++++ .../Basic Tasks/AudioSource/GetMinDistance.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/GetMute.cs | 45 +++++++++++++++++++++ .../Basic Tasks/AudioSource/GetMute.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/GetPan.cs | 47 ++++++++++++++++++++++ .../Runtime/Basic Tasks/AudioSource/GetPan.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/GetPanLevel.cs | 47 ++++++++++++++++++++++ .../Basic Tasks/AudioSource/GetPanLevel.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/GetPitch.cs | 45 +++++++++++++++++++++ .../Basic Tasks/AudioSource/GetPitch.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/GetPriority.cs | 45 +++++++++++++++++++++ .../Basic Tasks/AudioSource/GetPriority.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/GetSpread.cs | 45 +++++++++++++++++++++ .../Basic Tasks/AudioSource/GetSpread.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/GetTime.cs | 45 +++++++++++++++++++++ .../Basic Tasks/AudioSource/GetTime.cs.meta | 8 ++++ .../Basic Tasks/AudioSource/GetTimeSamples.cs | 45 +++++++++++++++++++++ .../Basic Tasks/AudioSource/GetTimeSamples.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/GetVolume.cs | 45 +++++++++++++++++++++ .../Basic Tasks/AudioSource/GetVolume.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/IsPlaying.cs | 39 ++++++++++++++++++ .../Basic Tasks/AudioSource/IsPlaying.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/Pause.cs | 41 +++++++++++++++++++ .../Runtime/Basic Tasks/AudioSource/Pause.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/Play.cs | 41 +++++++++++++++++++ .../Runtime/Basic Tasks/AudioSource/Play.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/PlayDelayed.cs | 44 ++++++++++++++++++++ .../Basic Tasks/AudioSource/PlayDelayed.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/PlayOneShot.cs | 47 ++++++++++++++++++++++ .../Basic Tasks/AudioSource/PlayOneShot.cs.meta | 8 ++++ .../Basic Tasks/AudioSource/PlayScheduled.cs | 44 ++++++++++++++++++++ .../Basic Tasks/AudioSource/PlayScheduled.cs.meta | 8 ++++ .../Basic Tasks/AudioSource/SetAudioClip.cs | 44 ++++++++++++++++++++ .../Basic Tasks/AudioSource/SetAudioClip.cs.meta | 8 ++++ .../AudioSource/SetIgnoreListenerPause.cs | 44 ++++++++++++++++++++ .../AudioSource/SetIgnoreListenerPause.cs.meta | 8 ++++ .../AudioSource/SetIgnoreListenerVolume.cs | 44 ++++++++++++++++++++ .../AudioSource/SetIgnoreListenerVolume.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/SetLoop.cs | 44 ++++++++++++++++++++ .../Basic Tasks/AudioSource/SetLoop.cs.meta | 8 ++++ .../Basic Tasks/AudioSource/SetMaxDistance.cs | 44 ++++++++++++++++++++ .../Basic Tasks/AudioSource/SetMaxDistance.cs.meta | 8 ++++ .../Basic Tasks/AudioSource/SetMinDistance.cs | 44 ++++++++++++++++++++ .../Basic Tasks/AudioSource/SetMinDistance.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/SetMute.cs | 44 ++++++++++++++++++++ .../Basic Tasks/AudioSource/SetMute.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/SetPan.cs | 46 +++++++++++++++++++++ .../Runtime/Basic Tasks/AudioSource/SetPan.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/SetPanLevel.cs | 46 +++++++++++++++++++++ .../Basic Tasks/AudioSource/SetPanLevel.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/SetPitch.cs | 44 ++++++++++++++++++++ .../Basic Tasks/AudioSource/SetPitch.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/SetPriority.cs | 44 ++++++++++++++++++++ .../Basic Tasks/AudioSource/SetPriority.cs.meta | 8 ++++ .../Basic Tasks/AudioSource/SetRolloffMode.cs | 44 ++++++++++++++++++++ .../Basic Tasks/AudioSource/SetRolloffMode.cs.meta | 8 ++++ .../Basic Tasks/AudioSource/SetScheduledEndTime.cs | 45 +++++++++++++++++++++ .../AudioSource/SetScheduledEndTime.cs.meta | 8 ++++ .../AudioSource/SetScheduledStartTime.cs | 44 ++++++++++++++++++++ .../AudioSource/SetScheduledStartTime.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/SetSpread.cs | 44 ++++++++++++++++++++ .../Basic Tasks/AudioSource/SetSpread.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/SetTime.cs | 44 ++++++++++++++++++++ .../Basic Tasks/AudioSource/SetTime.cs.meta | 8 ++++ .../AudioSource/SetVelocityUpdateMode.cs | 44 ++++++++++++++++++++ .../AudioSource/SetVelocityUpdateMode.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/SetVolume.cs | 44 ++++++++++++++++++++ .../Basic Tasks/AudioSource/SetVolume.cs.meta | 8 ++++ .../Runtime/Basic Tasks/AudioSource/Stop.cs | 41 +++++++++++++++++++ .../Runtime/Basic Tasks/AudioSource/Stop.cs.meta | 8 ++++ 78 files changed, 2040 insertions(+) create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetIgnoreListenerPause.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetIgnoreListenerPause.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetIgnoreListenerVolume.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetIgnoreListenerVolume.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetLoop.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetLoop.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMaxDistance.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMaxDistance.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMinDistance.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMinDistance.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMute.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMute.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPan.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPan.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPanLevel.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPanLevel.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPitch.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPitch.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPriority.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPriority.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetSpread.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetSpread.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetTime.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetTime.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetTimeSamples.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetTimeSamples.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetVolume.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetVolume.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/IsPlaying.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/IsPlaying.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Pause.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Pause.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Play.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Play.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayDelayed.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayDelayed.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayOneShot.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayOneShot.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayScheduled.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayScheduled.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetAudioClip.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetAudioClip.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetIgnoreListenerPause.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetIgnoreListenerPause.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetIgnoreListenerVolume.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetIgnoreListenerVolume.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetLoop.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetLoop.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMaxDistance.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMaxDistance.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMinDistance.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMinDistance.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMute.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMute.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPan.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPan.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPanLevel.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPanLevel.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPitch.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPitch.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPriority.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPriority.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetRolloffMode.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetRolloffMode.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetScheduledEndTime.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetScheduledEndTime.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetScheduledStartTime.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetScheduledStartTime.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetSpread.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetSpread.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetTime.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetTime.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetVelocityUpdateMode.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetVelocityUpdateMode.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetVolume.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetVolume.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Stop.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Stop.cs.meta (limited to 'Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource') diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetIgnoreListenerPause.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetIgnoreListenerPause.cs new file mode 100644 index 00000000..e0906252 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetIgnoreListenerPause.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetIgnoreListenerPause.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetIgnoreListenerPause.cs.meta new file mode 100644 index 00000000..aca007cf --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetIgnoreListenerPause.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b3bd7bb287fe91747bca60ebe3d53e87 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetIgnoreListenerVolume.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetIgnoreListenerVolume.cs new file mode 100644 index 00000000..12885ddf --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetIgnoreListenerVolume.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetIgnoreListenerVolume.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetIgnoreListenerVolume.cs.meta new file mode 100644 index 00000000..5176b8f8 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetIgnoreListenerVolume.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c45986918364dfc4e9eca01d2839e2e4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetLoop.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetLoop.cs new file mode 100644 index 00000000..c1cd0a7d --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetLoop.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetLoop.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetLoop.cs.meta new file mode 100644 index 00000000..a5d37f95 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetLoop.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 699b9d0d798a219459c6477d2c21d4ba +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMaxDistance.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMaxDistance.cs new file mode 100644 index 00000000..cf8b9ed3 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMaxDistance.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMaxDistance.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMaxDistance.cs.meta new file mode 100644 index 00000000..2cb3e832 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMaxDistance.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3e2b2500d8e2b0c45825c0650f64eae2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMinDistance.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMinDistance.cs new file mode 100644 index 00000000..6fe9aed3 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMinDistance.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMinDistance.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMinDistance.cs.meta new file mode 100644 index 00000000..20401fd0 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMinDistance.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cad762e82ef22644ca968b4a1c51eaec +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMute.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMute.cs new file mode 100644 index 00000000..f2cee2f2 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMute.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMute.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMute.cs.meta new file mode 100644 index 00000000..71acfb23 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetMute.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 51df88b2df77e294cb673105b1c36961 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPan.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPan.cs new file mode 100644 index 00000000..7b3776f0 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPan.cs @@ -0,0 +1,47 @@ +#if UNITY_4_6 || UNITY_4_7 +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/AudioSource")] + [TaskDescription("Stores the pan value of the AudioSource. Returns Success.")] + public class GetPan : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The pan 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.pan; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 1; + } + } +} +#endif \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPan.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPan.cs.meta new file mode 100644 index 00000000..412a9887 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPan.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 181cebd8ca2b5da47a89cd738e36e4dd +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPanLevel.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPanLevel.cs new file mode 100644 index 00000000..0084d836 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPanLevel.cs @@ -0,0 +1,47 @@ +#if UNITY_4_6 || UNITY_4_7 +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/AudioSource")] + [TaskDescription("Stores the pan level value of the AudioSource. Returns Success.")] + public class GetPanLevel : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The pan level 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.panLevel; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 1; + } + } +} +#endif \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPanLevel.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPanLevel.cs.meta new file mode 100644 index 00000000..3a177668 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPanLevel.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f00191099bcac3c4fad2922fbc8ede2b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPitch.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPitch.cs new file mode 100644 index 00000000..21ddf55d --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPitch.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPitch.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPitch.cs.meta new file mode 100644 index 00000000..c23193a0 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPitch.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 930fa7881ae9236449d90546f9922656 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPriority.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPriority.cs new file mode 100644 index 00000000..bb519ef0 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPriority.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPriority.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPriority.cs.meta new file mode 100644 index 00000000..4bf1ba3e --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetPriority.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: de856d580ad945e4d846fa52d3d647cc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetSpread.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetSpread.cs new file mode 100644 index 00000000..a4b28d99 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetSpread.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetSpread.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetSpread.cs.meta new file mode 100644 index 00000000..8616ca5f --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetSpread.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ba6a60eccf688514392e782348b84628 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetTime.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetTime.cs new file mode 100644 index 00000000..1838133a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetTime.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetTime.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetTime.cs.meta new file mode 100644 index 00000000..3d1c547f --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetTime.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 600c95fc760afa140bd0a7b98bd5071f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetTimeSamples.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetTimeSamples.cs new file mode 100644 index 00000000..367f4b3f --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetTimeSamples.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetTimeSamples.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetTimeSamples.cs.meta new file mode 100644 index 00000000..40d3ea23 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetTimeSamples.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: af34adc5779f33442909ff32140dcdd4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetVolume.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetVolume.cs new file mode 100644 index 00000000..4610f4ba --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetVolume.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetVolume.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetVolume.cs.meta new file mode 100644 index 00000000..fdb362b6 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/GetVolume.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aad3b2c644baeb646b0b33b7317413d4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/IsPlaying.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/IsPlaying.cs new file mode 100644 index 00000000..7b457902 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/IsPlaying.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/IsPlaying.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/IsPlaying.cs.meta new file mode 100644 index 00000000..e830c656 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/IsPlaying.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 20fb79d98326b794fb309a291613cab4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Pause.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Pause.cs new file mode 100644 index 00000000..1d5347ad --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Pause.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Pause.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Pause.cs.meta new file mode 100644 index 00000000..140e52a3 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Pause.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 91db8dd58e79db745acc39f3f52da88e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Play.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Play.cs new file mode 100644 index 00000000..3e711027 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Play.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Play.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Play.cs.meta new file mode 100644 index 00000000..52452b5a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Play.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7ac8cfb80c6a44c42b4ac4eef6f29bd5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayDelayed.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayDelayed.cs new file mode 100644 index 00000000..7618bd7c --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayDelayed.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayDelayed.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayDelayed.cs.meta new file mode 100644 index 00000000..fb881a38 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayDelayed.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0125706a59bb7974eb3d425d3869779a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayOneShot.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayOneShot.cs new file mode 100644 index 00000000..1d04f8e0 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayOneShot.cs @@ -0,0 +1,47 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayOneShot.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayOneShot.cs.meta new file mode 100644 index 00000000..4bc09ae8 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayOneShot.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 112c969d16008464f96ce23aa5b32486 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayScheduled.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayScheduled.cs new file mode 100644 index 00000000..d854790d --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayScheduled.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayScheduled.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayScheduled.cs.meta new file mode 100644 index 00000000..8c3e45f7 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/PlayScheduled.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 08d431471ffd8954197b88b698f0d424 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetAudioClip.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetAudioClip.cs new file mode 100644 index 00000000..71941195 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetAudioClip.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetAudioClip.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetAudioClip.cs.meta new file mode 100644 index 00000000..df8eac5c --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetAudioClip.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f52d9d404f7deab448e4f5c2bb3f7892 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetIgnoreListenerPause.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetIgnoreListenerPause.cs new file mode 100644 index 00000000..1b0f14b3 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetIgnoreListenerPause.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetIgnoreListenerPause.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetIgnoreListenerPause.cs.meta new file mode 100644 index 00000000..e6c2790c --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetIgnoreListenerPause.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d617db8232463c444a8a3159da109798 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetIgnoreListenerVolume.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetIgnoreListenerVolume.cs new file mode 100644 index 00000000..787637b2 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetIgnoreListenerVolume.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetIgnoreListenerVolume.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetIgnoreListenerVolume.cs.meta new file mode 100644 index 00000000..6b86a289 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetIgnoreListenerVolume.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6f1f5937bfa03484296c0fb5a9ce9b29 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetLoop.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetLoop.cs new file mode 100644 index 00000000..38a47ba3 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetLoop.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetLoop.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetLoop.cs.meta new file mode 100644 index 00000000..d8e3cc04 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetLoop.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 50536bd6b5fa6924bb7217dd3b6e3f45 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMaxDistance.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMaxDistance.cs new file mode 100644 index 00000000..17487708 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMaxDistance.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMaxDistance.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMaxDistance.cs.meta new file mode 100644 index 00000000..2d67b172 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMaxDistance.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b0c75cf2afc289c4a8962f71b5e17dd1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMinDistance.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMinDistance.cs new file mode 100644 index 00000000..f693e4a8 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMinDistance.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMinDistance.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMinDistance.cs.meta new file mode 100644 index 00000000..6e87631a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMinDistance.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ccb3beba9296fc54d8427cd646af4f4e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMute.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMute.cs new file mode 100644 index 00000000..0d45e2df --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMute.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMute.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMute.cs.meta new file mode 100644 index 00000000..7296e828 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetMute.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ec553c7ad9360a24fb7ce3bf3bc48c97 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPan.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPan.cs new file mode 100644 index 00000000..bd6d1853 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPan.cs @@ -0,0 +1,46 @@ +#if UNITY_4_6 || UNITY_4_7 +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/AudioSource")] + [TaskDescription("Sets the pan value of the AudioSource. Returns Success.")] + public class SetPan : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The pan value of the AudioSource")] + public SharedFloat pan; + + 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.pan = pan.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + pan = 1; + } + } +} +#endif \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPan.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPan.cs.meta new file mode 100644 index 00000000..5ee56ec2 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPan.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ed66670f171cea24c9208fff10bfc43d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPanLevel.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPanLevel.cs new file mode 100644 index 00000000..b1f24307 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPanLevel.cs @@ -0,0 +1,46 @@ +#if UNITY_4_6 || UNITY_4_7 +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/AudioSource")] + [TaskDescription("Sets the pan level value of the AudioSource. Returns Success.")] + public class SetPanLevel : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The pan level value of the AudioSource")] + public SharedFloat panLevel; + + 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.panLevel = panLevel.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + panLevel = 1; + } + } +} +#endif \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPanLevel.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPanLevel.cs.meta new file mode 100644 index 00000000..ca4e90f7 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPanLevel.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 219609a4a0818d746a7828dc968c31a9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPitch.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPitch.cs new file mode 100644 index 00000000..9a6de27f --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPitch.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPitch.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPitch.cs.meta new file mode 100644 index 00000000..71a8ff21 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPitch.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3c7615ddc4e92fd41b72de06f039f9e1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPriority.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPriority.cs new file mode 100644 index 00000000..1a1532ea --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPriority.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPriority.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPriority.cs.meta new file mode 100644 index 00000000..0a8e4128 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetPriority.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4fc15622e17101f4b95be39910433c8a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetRolloffMode.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetRolloffMode.cs new file mode 100644 index 00000000..0b142108 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetRolloffMode.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetRolloffMode.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetRolloffMode.cs.meta new file mode 100644 index 00000000..0d7fe458 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetRolloffMode.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ef88d71b5b7e0a84d98bde6405eb294d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetScheduledEndTime.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetScheduledEndTime.cs new file mode 100644 index 00000000..b214f713 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetScheduledEndTime.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetScheduledEndTime.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetScheduledEndTime.cs.meta new file mode 100644 index 00000000..3f0af6c4 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetScheduledEndTime.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8867d64aa9a2add4f913b8b5faa9d1ce +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetScheduledStartTime.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetScheduledStartTime.cs new file mode 100644 index 00000000..4c5b890c --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetScheduledStartTime.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetScheduledStartTime.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetScheduledStartTime.cs.meta new file mode 100644 index 00000000..4dbd7c6a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetScheduledStartTime.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cf64b74120564064a8d9c622ccc7115a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetSpread.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetSpread.cs new file mode 100644 index 00000000..f4657fcd --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetSpread.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetSpread.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetSpread.cs.meta new file mode 100644 index 00000000..89329407 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetSpread.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f6d964d5fdf24bf449d3f59de1864dd8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetTime.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetTime.cs new file mode 100644 index 00000000..637789e8 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetTime.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetTime.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetTime.cs.meta new file mode 100644 index 00000000..bc128b7a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetTime.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3173ce3fda9d60f48b159759f8981f89 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetVelocityUpdateMode.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetVelocityUpdateMode.cs new file mode 100644 index 00000000..53dddaa0 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetVelocityUpdateMode.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetVelocityUpdateMode.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetVelocityUpdateMode.cs.meta new file mode 100644 index 00000000..606e6903 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetVelocityUpdateMode.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c26ea6b22d3fa7843a73e5088376996c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetVolume.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetVolume.cs new file mode 100644 index 00000000..80ee7189 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetVolume.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetVolume.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetVolume.cs.meta new file mode 100644 index 00000000..16176d79 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/SetVolume.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: edfc39045c7af164fb340d21762e4d79 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Stop.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Stop.cs new file mode 100644 index 00000000..f351635c --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Stop.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityAudioSource +{ + [TaskCategory("Basic/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/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Stop.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Stop.cs.meta new file mode 100644 index 00000000..66ee21a5 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/AudioSource/Stop.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bd4cec1e9e81e664d8e7782bd02bcade +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: -- cgit v1.1-26-g67d0