From 97da432c35b8c7aaf9dd2c39e2aa4b1f55f36065 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 27 Jan 2021 16:15:06 +0800 Subject: +behaviour designer --- .../Runtime/Basic Tasks/ParticleSystem/Clear.cs | 41 ++++++++++++++++++ .../Basic Tasks/ParticleSystem/Clear.cs.meta | 8 ++++ .../Basic Tasks/ParticleSystem/GetDuration.cs | 45 ++++++++++++++++++++ .../Basic Tasks/ParticleSystem/GetDuration.cs.meta | 8 ++++ .../Basic Tasks/ParticleSystem/GetEmissionRate.cs | 49 ++++++++++++++++++++++ .../ParticleSystem/GetEmissionRate.cs.meta | 8 ++++ .../ParticleSystem/GetEnableEmission.cs | 49 ++++++++++++++++++++++ .../ParticleSystem/GetEnableEmission.cs.meta | 8 ++++ .../ParticleSystem/GetGravityModifier.cs | 45 ++++++++++++++++++++ .../ParticleSystem/GetGravityModifier.cs.meta | 8 ++++ .../Runtime/Basic Tasks/ParticleSystem/GetLoop.cs | 45 ++++++++++++++++++++ .../Basic Tasks/ParticleSystem/GetLoop.cs.meta | 8 ++++ .../Basic Tasks/ParticleSystem/GetMaxParticles.cs | 45 ++++++++++++++++++++ .../ParticleSystem/GetMaxParticles.cs.meta | 8 ++++ .../Basic Tasks/ParticleSystem/GetParticleCount.cs | 45 ++++++++++++++++++++ .../ParticleSystem/GetParticleCount.cs.meta | 8 ++++ .../Basic Tasks/ParticleSystem/GetPlaybackSpeed.cs | 45 ++++++++++++++++++++ .../ParticleSystem/GetPlaybackSpeed.cs.meta | 8 ++++ .../Runtime/Basic Tasks/ParticleSystem/GetTime.cs | 45 ++++++++++++++++++++ .../Basic Tasks/ParticleSystem/GetTime.cs.meta | 8 ++++ .../Runtime/Basic Tasks/ParticleSystem/IsAlive.cs | 39 +++++++++++++++++ .../Basic Tasks/ParticleSystem/IsAlive.cs.meta | 8 ++++ .../Runtime/Basic Tasks/ParticleSystem/IsPaused.cs | 39 +++++++++++++++++ .../Basic Tasks/ParticleSystem/IsPaused.cs.meta | 8 ++++ .../Basic Tasks/ParticleSystem/IsPlaying.cs | 39 +++++++++++++++++ .../Basic Tasks/ParticleSystem/IsPlaying.cs.meta | 8 ++++ .../Basic Tasks/ParticleSystem/IsStopped.cs | 39 +++++++++++++++++ .../Basic Tasks/ParticleSystem/IsStopped.cs.meta | 8 ++++ .../Runtime/Basic Tasks/ParticleSystem/Pause.cs | 41 ++++++++++++++++++ .../Basic Tasks/ParticleSystem/Pause.cs.meta | 8 ++++ .../Runtime/Basic Tasks/ParticleSystem/Play.cs | 41 ++++++++++++++++++ .../Basic Tasks/ParticleSystem/Play.cs.meta | 8 ++++ .../Basic Tasks/ParticleSystem/SetEmissionRate.cs | 48 +++++++++++++++++++++ .../ParticleSystem/SetEmissionRate.cs.meta | 8 ++++ .../ParticleSystem/SetEnableEmission.cs | 49 ++++++++++++++++++++++ .../ParticleSystem/SetEnableEmission.cs.meta | 8 ++++ .../ParticleSystem/SetGravityModifier.cs | 44 +++++++++++++++++++ .../ParticleSystem/SetGravityModifier.cs.meta | 8 ++++ .../Runtime/Basic Tasks/ParticleSystem/SetLoop.cs | 44 +++++++++++++++++++ .../Basic Tasks/ParticleSystem/SetLoop.cs.meta | 8 ++++ .../Basic Tasks/ParticleSystem/SetMaxParticles.cs | 44 +++++++++++++++++++ .../ParticleSystem/SetMaxParticles.cs.meta | 8 ++++ .../Basic Tasks/ParticleSystem/SetPlaybackSpeed.cs | 44 +++++++++++++++++++ .../ParticleSystem/SetPlaybackSpeed.cs.meta | 8 ++++ .../Basic Tasks/ParticleSystem/SetStartColor.cs | 44 +++++++++++++++++++ .../ParticleSystem/SetStartColor.cs.meta | 8 ++++ .../Basic Tasks/ParticleSystem/SetStartDelay.cs | 44 +++++++++++++++++++ .../ParticleSystem/SetStartDelay.cs.meta | 8 ++++ .../Basic Tasks/ParticleSystem/SetStartLifetime.cs | 44 +++++++++++++++++++ .../ParticleSystem/SetStartLifetime.cs.meta | 8 ++++ .../Basic Tasks/ParticleSystem/SetStartRotation.cs | 44 +++++++++++++++++++ .../ParticleSystem/SetStartRotation.cs.meta | 8 ++++ .../Basic Tasks/ParticleSystem/SetStartSize.cs | 44 +++++++++++++++++++ .../ParticleSystem/SetStartSize.cs.meta | 8 ++++ .../Basic Tasks/ParticleSystem/SetStartSpeed.cs | 44 +++++++++++++++++++ .../ParticleSystem/SetStartSpeed.cs.meta | 8 ++++ .../Runtime/Basic Tasks/ParticleSystem/SetTime.cs | 44 +++++++++++++++++++ .../Basic Tasks/ParticleSystem/SetTime.cs.meta | 8 ++++ .../Runtime/Basic Tasks/ParticleSystem/Simulate.cs | 44 +++++++++++++++++++ .../Basic Tasks/ParticleSystem/Simulate.cs.meta | 8 ++++ .../Runtime/Basic Tasks/ParticleSystem/Stop.cs | 41 ++++++++++++++++++ .../Basic Tasks/ParticleSystem/Stop.cs.meta | 8 ++++ 62 files changed, 1606 insertions(+) create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Clear.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Clear.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetDuration.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetDuration.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetEmissionRate.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetEmissionRate.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetEnableEmission.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetEnableEmission.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetGravityModifier.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetGravityModifier.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetLoop.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetLoop.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetMaxParticles.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetMaxParticles.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetParticleCount.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetParticleCount.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetPlaybackSpeed.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetPlaybackSpeed.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetTime.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetTime.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsAlive.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsAlive.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsPaused.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsPaused.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsPlaying.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsPlaying.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsStopped.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsStopped.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Pause.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Pause.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Play.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Play.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetEmissionRate.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetEmissionRate.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetEnableEmission.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetEnableEmission.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetGravityModifier.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetGravityModifier.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetLoop.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetLoop.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetMaxParticles.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetMaxParticles.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetPlaybackSpeed.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetPlaybackSpeed.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartColor.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartColor.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartDelay.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartDelay.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartLifetime.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartLifetime.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartRotation.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartRotation.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartSize.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartSize.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartSpeed.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartSpeed.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetTime.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetTime.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Simulate.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Simulate.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Stop.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Stop.cs.meta (limited to 'Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem') diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Clear.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Clear.cs new file mode 100644 index 00000000..38988c82 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Clear.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Clear the Particle System.")] + public class Clear : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + particleSystem.Clear(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Clear.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Clear.cs.meta new file mode 100644 index 00000000..63db0e0c --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Clear.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: de273e542591d5946a8728190438ae27 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetDuration.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetDuration.cs new file mode 100644 index 00000000..304497d5 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetDuration.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Stores the duration of the Particle System.")] + public class GetDuration : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The duration of the ParticleSystem")] + [RequiredField] + public SharedFloat storeResult; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + storeResult.Value = particleSystem.main.duration; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetDuration.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetDuration.cs.meta new file mode 100644 index 00000000..f41e7cee --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetDuration.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 02a4d610e82f1854c87701c4d51957fb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetEmissionRate.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetEmissionRate.cs new file mode 100644 index 00000000..c13c0470 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetEmissionRate.cs @@ -0,0 +1,49 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Stores the emission rate of the Particle System.")] + public class GetEmissionRate : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The emission rate of the ParticleSystem")] + [RequiredField] + public SharedFloat storeResult; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + +#if !(UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2) + Debug.Log("Warning: GetEmissionRate is not used in Unity 5.3 or later."); +#else + storeResult.Value = particleSystem.emissionRate; +#endif + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetEmissionRate.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetEmissionRate.cs.meta new file mode 100644 index 00000000..1658d847 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetEmissionRate.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3adb98115d27ec64da9b5f56391570be +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetEnableEmission.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetEnableEmission.cs new file mode 100644 index 00000000..f0a01b0e --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetEnableEmission.cs @@ -0,0 +1,49 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Stores if the Particle System is emitting particles.")] + public class GetEnableEmission : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Is the Particle System emitting particles?")] + [RequiredField] + public SharedBool storeResult; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + +#if !(UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2) + storeResult.Value = particleSystem.emission.enabled; +#else + storeResult.Value = particleSystem.enableEmission; +#endif + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = false; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetEnableEmission.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetEnableEmission.cs.meta new file mode 100644 index 00000000..e894a6e4 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetEnableEmission.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 81dc1a241a2c872409a7919742df7581 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetGravityModifier.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetGravityModifier.cs new file mode 100644 index 00000000..d967061a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetGravityModifier.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Stores the gravity modifier of the Particle System.")] + public class GetGravityModifier : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The gravity modifier of the ParticleSystem")] + [RequiredField] + public SharedFloat storeResult; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + storeResult.Value = particleSystem.main.gravityModifierMultiplier; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetGravityModifier.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetGravityModifier.cs.meta new file mode 100644 index 00000000..3412f534 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetGravityModifier.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7001d2ab41ef4e64190afc7f9bce1876 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetLoop.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetLoop.cs new file mode 100644 index 00000000..aea4858e --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetLoop.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Stores if the Particle System should loop.")] + public class GetLoop : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Should the ParticleSystem loop?")] + [RequiredField] + public SharedBool storeResult; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + storeResult.Value = particleSystem.main.loop; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = false; + } + } +} diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetLoop.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetLoop.cs.meta new file mode 100644 index 00000000..bfa703a0 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetLoop.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 82f4ee8cf50887a4488fe6d0da18afc0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetMaxParticles.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetMaxParticles.cs new file mode 100644 index 00000000..7e71ccc0 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetMaxParticles.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Stores the max particles of the Particle System.")] + public class GetMaxParticles : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The max particles of the ParticleSystem")] + [RequiredField] + public SharedFloat storeResult; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + storeResult.Value = particleSystem.main.maxParticles; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = 0; + } + } +} diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetMaxParticles.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetMaxParticles.cs.meta new file mode 100644 index 00000000..8e026028 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetMaxParticles.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 429771af65df81c49aaf4b34630473fe +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetParticleCount.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetParticleCount.cs new file mode 100644 index 00000000..06c4fe96 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetParticleCount.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Stores the particle count of the Particle System.")] + public class GetParticleCount : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The particle count of the ParticleSystem")] + [RequiredField] + public SharedFloat storeResult; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + storeResult.Value = particleSystem.particleCount; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetParticleCount.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetParticleCount.cs.meta new file mode 100644 index 00000000..c1cfbc05 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetParticleCount.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f32e2ff9de4ff7b47a256ac3b51123c6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetPlaybackSpeed.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetPlaybackSpeed.cs new file mode 100644 index 00000000..37b3e620 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetPlaybackSpeed.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Stores the playback speed of the Particle System.")] + public class GetPlaybackSpeed : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The playback speed of the ParticleSystem")] + [RequiredField] + public SharedFloat storeResult; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + storeResult.Value = particleSystem.main.simulationSpeed; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetPlaybackSpeed.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetPlaybackSpeed.cs.meta new file mode 100644 index 00000000..12e27063 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetPlaybackSpeed.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f8f29f170ac706b498e7c933136d8036 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetTime.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetTime.cs new file mode 100644 index 00000000..315474d5 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetTime.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Stores the time of the Particle System.")] + public class GetTime : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The time of the ParticleSystem")] + [RequiredField] + public SharedFloat storeResult; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + storeResult.Value = particleSystem.time; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeResult = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetTime.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetTime.cs.meta new file mode 100644 index 00000000..0cd924dc --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/GetTime.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9b15c7efbf98f7649adf8dd4474b0579 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsAlive.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsAlive.cs new file mode 100644 index 00000000..49f56b98 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsAlive.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Is the Particle System alive?")] + public class IsAlive : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + return particleSystem.IsAlive() ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsAlive.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsAlive.cs.meta new file mode 100644 index 00000000..aa294a13 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsAlive.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3d554784e9a9fa040a2446402ba3f10e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsPaused.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsPaused.cs new file mode 100644 index 00000000..d0180464 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsPaused.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Is the Particle System paused?")] + public class IsPaused : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + return particleSystem.isPaused ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsPaused.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsPaused.cs.meta new file mode 100644 index 00000000..00a5c85f --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsPaused.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e4e9ab132f20dfa4095b3c90303ebf74 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsPlaying.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsPlaying.cs new file mode 100644 index 00000000..ee9f9472 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsPlaying.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Is the Particle System playing?")] + public class IsPlaying : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + return particleSystem.isPlaying ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsPlaying.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsPlaying.cs.meta new file mode 100644 index 00000000..d3f13e4d --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsPlaying.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 654b51e99f64bfb489e12866a569f00e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsStopped.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsStopped.cs new file mode 100644 index 00000000..39642507 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsStopped.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Is the Particle System stopped?")] + public class IsStopped : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + return particleSystem.isStopped ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsStopped.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsStopped.cs.meta new file mode 100644 index 00000000..d0a054fb --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/IsStopped.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c719a7379c22b184380b4e63ccdfd064 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Pause.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Pause.cs new file mode 100644 index 00000000..496b2db5 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Pause.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Pause the Particle System.")] + public class Pause : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + particleSystem.Pause(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Pause.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Pause.cs.meta new file mode 100644 index 00000000..d6e60239 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Pause.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c9c9cc56691817b49af4fd1cfbc3e363 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Play.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Play.cs new file mode 100644 index 00000000..6797351c --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Play.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Play the Particle System.")] + public class Play : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + particleSystem.Play(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Play.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Play.cs.meta new file mode 100644 index 00000000..276c73c4 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Play.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a8ffb889d35074d4fb08d8502155c0b2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetEmissionRate.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetEmissionRate.cs new file mode 100644 index 00000000..c0d7a6d4 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetEmissionRate.cs @@ -0,0 +1,48 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Sets the emission rate of the Particle System.")] + public class SetEmissionRate : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The emission rate of the ParticleSystem")] + public SharedFloat emissionRate; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + +#if !(UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2) + Debug.Log("Warning: SetEmissionRate is not used in Unity 5.3 or later."); +#else + particleSystem.emissionRate = emissionRate.Value; +#endif + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + emissionRate = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetEmissionRate.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetEmissionRate.cs.meta new file mode 100644 index 00000000..ac56602a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetEmissionRate.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a8300eee629ad77419f2eb91477a0b62 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetEnableEmission.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetEnableEmission.cs new file mode 100644 index 00000000..1c47207e --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetEnableEmission.cs @@ -0,0 +1,49 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Enables or disables the Particle System emission.")] + public class SetEnableEmission : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Enable the ParticleSystem emissions?")] + public SharedBool enable; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + +#if !(UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2) + var emission = particleSystem.emission; + emission.enabled = enable.Value; +#else + particleSystem.enableEmission = enable.Value; +#endif + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + enable = false; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetEnableEmission.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetEnableEmission.cs.meta new file mode 100644 index 00000000..d5d77a69 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetEnableEmission.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f7c295b4d24628146a885d21bf699993 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetGravityModifier.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetGravityModifier.cs new file mode 100644 index 00000000..1082989d --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetGravityModifier.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Sets the gravity modifier of the Particle System.")] + public class SetGravityModifier : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The gravity modifier of the ParticleSystem")] + public SharedFloat gravityModifier; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + ParticleSystem.MainModule main = particleSystem.main; + main.gravityModifierMultiplier = gravityModifier.Value; + //particleSystem.main = main; + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + gravityModifier = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetGravityModifier.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetGravityModifier.cs.meta new file mode 100644 index 00000000..8337a101 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetGravityModifier.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c1a6694791042df4ea2097a2508bd8de +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetLoop.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetLoop.cs new file mode 100644 index 00000000..8706fe53 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetLoop.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Sets if the Particle System should loop.")] + public class SetLoop : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Should the ParticleSystem loop?")] + public SharedBool loop; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + ParticleSystem.MainModule main = particleSystem.main; + main.loop = loop.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + loop = false; + } + } +} diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetLoop.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetLoop.cs.meta new file mode 100644 index 00000000..169ffad8 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetLoop.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b9fa90adc0377cc4592de00e410a4060 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetMaxParticles.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetMaxParticles.cs new file mode 100644 index 00000000..a1d8730a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetMaxParticles.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Sets the max particles of the Particle System.")] + public class SetMaxParticles : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The max particles of the ParticleSystem")] + public SharedInt maxParticles; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + ParticleSystem.MainModule main = particleSystem.main; + main.maxParticles = maxParticles.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + maxParticles = 0; + } + } +} diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetMaxParticles.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetMaxParticles.cs.meta new file mode 100644 index 00000000..8549f671 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetMaxParticles.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eadca930ad32a404886060ee43e4d802 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetPlaybackSpeed.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetPlaybackSpeed.cs new file mode 100644 index 00000000..0e3d23db --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetPlaybackSpeed.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Sets the playback speed of the Particle System.")] + public class SetPlaybackSpeed : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The playback speed of the ParticleSystem")] + public SharedFloat playbackSpeed = 1; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + ParticleSystem.MainModule main = particleSystem.main; + main.simulationSpeed = playbackSpeed.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + playbackSpeed = 1; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetPlaybackSpeed.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetPlaybackSpeed.cs.meta new file mode 100644 index 00000000..1c0afbdb --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetPlaybackSpeed.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8f4d79e34ac8820458a2813895d3962d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartColor.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartColor.cs new file mode 100644 index 00000000..0af7d9bb --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartColor.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Sets the start color of the Particle System.")] + public class SetStartColor : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The start color of the ParticleSystem")] + public SharedColor startColor; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + ParticleSystem.MainModule main = particleSystem.main; + main.startColor = startColor.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + startColor = Color.white; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartColor.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartColor.cs.meta new file mode 100644 index 00000000..12432173 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartColor.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f91be163d0c01ec42bf120c267dcceea +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartDelay.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartDelay.cs new file mode 100644 index 00000000..f814e540 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartDelay.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Sets the start delay of the Particle System.")] + public class SetStartDelay : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The start delay of the ParticleSystem")] + public SharedFloat startDelay; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + ParticleSystem.MainModule main = particleSystem.main; + main.startDelayMultiplier = startDelay.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + startDelay = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartDelay.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartDelay.cs.meta new file mode 100644 index 00000000..fb4c01f5 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartDelay.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 532026cf3b430c840897e66bdde5006e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartLifetime.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartLifetime.cs new file mode 100644 index 00000000..0bfec7a7 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartLifetime.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Sets the start lifetime of the Particle System.")] + public class SetStartLifetime : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The start lifetime of the ParticleSystem")] + public SharedFloat startLifetime; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + ParticleSystem.MainModule main = particleSystem.main; + main.startLifetimeMultiplier = startLifetime.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + startLifetime = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartLifetime.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartLifetime.cs.meta new file mode 100644 index 00000000..361689aa --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartLifetime.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 311b9ed850b4e2243ae44487b9ece819 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartRotation.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartRotation.cs new file mode 100644 index 00000000..404acbf3 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartRotation.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Sets the start rotation of the Particle System.")] + public class SetStartRotation : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The start rotation of the ParticleSystem")] + public SharedFloat startRotation; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + ParticleSystem.MainModule main = particleSystem.main; + main.startRotationMultiplier = startRotation.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + startRotation = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartRotation.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartRotation.cs.meta new file mode 100644 index 00000000..c995958e --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartRotation.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ae611ab09913de6438aeb81d7a621c51 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartSize.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartSize.cs new file mode 100644 index 00000000..bb6667e5 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartSize.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Sets the start size of the Particle System.")] + public class SetStartSize : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The start size of the ParticleSystem")] + public SharedFloat startSize; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + ParticleSystem.MainModule main = particleSystem.main; + main.startSizeMultiplier = startSize.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + startSize = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartSize.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartSize.cs.meta new file mode 100644 index 00000000..d697099c --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartSize.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d7be6a1da3f4f7a418e5739a6cc6e78e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartSpeed.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartSpeed.cs new file mode 100644 index 00000000..6e9b155c --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartSpeed.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Sets the start speed of the Particle System.")] + public class SetStartSpeed : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The start speed of the ParticleSystem")] + public SharedFloat startSpeed; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + ParticleSystem.MainModule main = particleSystem.main; + main.startSpeedMultiplier = startSpeed.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + startSpeed = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartSpeed.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartSpeed.cs.meta new file mode 100644 index 00000000..f87bf954 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetStartSpeed.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b7716318475d3854a96729d1a7540d4a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetTime.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetTime.cs new file mode 100644 index 00000000..41f2e9eb --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetTime.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Sets the time of the Particle System.")] + public class SetTime : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The time of the ParticleSystem")] + public SharedFloat time; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + particleSystem.time = time.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + time = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetTime.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetTime.cs.meta new file mode 100644 index 00000000..2788eb15 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/SetTime.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 103e78e9c755fe3469e63115eb1c0d80 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Simulate.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Simulate.cs new file mode 100644 index 00000000..fcf70cfb --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Simulate.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Simulate the Particle System.")] + public class Simulate : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("Time to fastfoward the Particle System to")] + public SharedFloat time; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + particleSystem.Simulate(time.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + time = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Simulate.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Simulate.cs.meta new file mode 100644 index 00000000..c703cb24 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Simulate.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 24d79d661acf61e44918320624b49dd5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Stop.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Stop.cs new file mode 100644 index 00000000..2ed84c15 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Stop.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityParticleSystem +{ + [TaskCategory("Basic/ParticleSystem")] + [TaskDescription("Stop the Particle System.")] + public class Stop : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private ParticleSystem particleSystem; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + particleSystem = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (particleSystem == null) { + Debug.LogWarning("ParticleSystem is null"); + return TaskStatus.Failure; + } + + particleSystem.Stop(); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Stop.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Stop.cs.meta new file mode 100644 index 00000000..695ec19d --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/ParticleSystem/Stop.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fd83617024d6bff44824a83b472db8e6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: -- cgit v1.1-26-g67d0