From be07514c9d0d3e16066d4401d135efacb4a555c6 Mon Sep 17 00:00:00 2001 From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Date: Sun, 8 Oct 2023 12:48:53 +0200 Subject: [PATCH] particles --- Assets/Resources/Games/animalAcrobat.prefab | 14 +++++++++++ .../Games/AnimalAcrobat/Elephant.prefab | 7 ++++++ .../Games/AnimalAcrobat/Giraffe.prefab | 6 +++++ .../Games/AnimalAcrobat/PlayerMonkey.prefab | 14 +++++------ .../Games/AnimalAcrobat/WhiteMonkey.prefab | 7 ++++++ .../Games/AnimalAcrobat/WhiteMonkeys.prefab | 6 +++++ .../Games/AnimalAcrobat/AcrobatPlayer.cs | 23 +++++++++++++++++++ .../Games/AnimalAcrobat/GiraffeInput.cs | 10 ++++++++ .../Games/AnimalAcrobat/ObstacleInput.cs | 10 ++++++++ 9 files changed, 90 insertions(+), 7 deletions(-) diff --git a/Assets/Resources/Games/animalAcrobat.prefab b/Assets/Resources/Games/animalAcrobat.prefab index abace587b..7e509cc2e 100644 --- a/Assets/Resources/Games/animalAcrobat.prefab +++ b/Assets/Resources/Games/animalAcrobat.prefab @@ -530,6 +530,7 @@ MonoBehaviour: _jumpStartCameraDistance: 3 _jumpStartDistance: -1.25 _giraffeCameraZoom: 12 + MonkeyMissed: 0 --- !u!1 &9154566379104488428 GameObject: m_ObjectHideFlags: 0 @@ -638,6 +639,16 @@ Transform: m_CorrespondingSourceObject: {fileID: 6171382744519440479, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3} m_PrefabInstance: {fileID: 8166682498639938566} m_PrefabAsset: {fileID: 0} +--- !u!198 &3875907379403851012 stripped +ParticleSystem: + m_CorrespondingSourceObject: {fileID: 4943860916442349826, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3} + m_PrefabInstance: {fileID: 8166682498639938566} + m_PrefabAsset: {fileID: 0} +--- !u!198 &3975180264645336726 stripped +ParticleSystem: + m_CorrespondingSourceObject: {fileID: 5079865856385702544, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3} + m_PrefabInstance: {fileID: 8166682498639938566} + m_PrefabAsset: {fileID: 0} --- !u!1 &5719573208726547716 stripped GameObject: m_CorrespondingSourceObject: {fileID: 4482739629151873282, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3} @@ -656,6 +667,9 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: offset: {x: 0, y: 0, z: 0} + _scroll: {fileID: 6038557817912069913} + _releaseParticle: {fileID: 3975180264645336726} + _trailParticle: {fileID: 3875907379403851012} _jumpDistanceStart: 6 _jumpDistance: 4 _jumpHeight: 4 diff --git a/Assets/Resources/Prefabs/Games/AnimalAcrobat/Elephant.prefab b/Assets/Resources/Prefabs/Games/AnimalAcrobat/Elephant.prefab index 8bd34bb98..ee140f03c 100644 --- a/Assets/Resources/Prefabs/Games/AnimalAcrobat/Elephant.prefab +++ b/Assets/Resources/Prefabs/Games/AnimalAcrobat/Elephant.prefab @@ -565,6 +565,7 @@ MonoBehaviour: _holdLength: 2 _ease: 4 _holdPadding: 1 + _holdPaddingStart: 0 _rotateRoot: {fileID: 2616646720197201304} _gripPoint: {fileID: 2131794628642567477} --- !u!114 &-4645702950898394595 @@ -581,6 +582,7 @@ MonoBehaviour: m_EditorClassIdentifier: _monkey: {fileID: 4283362470282314707} _holdLength: 2 + _holdParticle: {fileID: 5372215907466563984} --- !u!114 &5550233630878919113 MonoBehaviour: m_ObjectHideFlags: 0 @@ -919,3 +921,8 @@ Animator: m_CorrespondingSourceObject: {fileID: 6945261984245565766, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3} m_PrefabInstance: {fileID: 6562599539575982741} m_PrefabAsset: {fileID: 0} +--- !u!198 &5372215907466563984 stripped +ParticleSystem: + m_CorrespondingSourceObject: {fileID: 1269725258759199493, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3} + m_PrefabInstance: {fileID: 6562599539575982741} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Resources/Prefabs/Games/AnimalAcrobat/Giraffe.prefab b/Assets/Resources/Prefabs/Games/AnimalAcrobat/Giraffe.prefab index 7840cb1ae..bea983698 100644 --- a/Assets/Resources/Prefabs/Games/AnimalAcrobat/Giraffe.prefab +++ b/Assets/Resources/Prefabs/Games/AnimalAcrobat/Giraffe.prefab @@ -322,6 +322,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _monkey: {fileID: 7559970804447045551} + _holdParticle: {fileID: 1807658667361072620} --- !u!114 &5165305002464474939 MonoBehaviour: m_ObjectHideFlags: 0 @@ -740,6 +741,11 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3} +--- !u!198 &1807658667361072620 stripped +ParticleSystem: + m_CorrespondingSourceObject: {fileID: 1269725258759199493, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3} + m_PrefabInstance: {fileID: 615004812187578089} + m_PrefabAsset: {fileID: 0} --- !u!4 &6714243032395732662 stripped Transform: m_CorrespondingSourceObject: {fileID: 6171382744519440479, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3} diff --git a/Assets/Resources/Prefabs/Games/AnimalAcrobat/PlayerMonkey.prefab b/Assets/Resources/Prefabs/Games/AnimalAcrobat/PlayerMonkey.prefab index 69021780f..08903324e 100644 --- a/Assets/Resources/Prefabs/Games/AnimalAcrobat/PlayerMonkey.prefab +++ b/Assets/Resources/Prefabs/Games/AnimalAcrobat/PlayerMonkey.prefab @@ -10297,12 +10297,12 @@ ParticleSystem: serializedVersion: 8 lengthInSec: 5 simulationSpeed: 1 - stopAction: 0 + stopAction: 2 cullingMode: 0 ringBufferMode: 0 ringBufferLoopRange: {x: 0, y: 1} emitterVelocityMode: 1 - looping: 1 + looping: 0 prewarm: 0 playOnAwake: 0 useUnscaledTime: 0 @@ -10360,7 +10360,7 @@ ParticleSystem: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 - moveWithTransform: 1 + moveWithTransform: 0 moveWithCustomTransform: {fileID: 0} scalingMode: 1 randomSeed: 0 @@ -20246,12 +20246,12 @@ ParticleSystem: serializedVersion: 8 lengthInSec: 5 simulationSpeed: 1 - stopAction: 0 + stopAction: 2 cullingMode: 0 ringBufferMode: 0 ringBufferLoopRange: {x: 0, y: 1} emitterVelocityMode: 1 - looping: 1 + looping: 0 prewarm: 0 playOnAwake: 0 useUnscaledTime: 0 @@ -20309,7 +20309,7 @@ ParticleSystem: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 - moveWithTransform: 1 + moveWithTransform: 0 moveWithCustomTransform: {fileID: 0} scalingMode: 1 randomSeed: 0 @@ -25354,7 +25354,7 @@ ParticleSystem: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 - moveWithTransform: 1 + moveWithTransform: 0 moveWithCustomTransform: {fileID: 0} scalingMode: 1 randomSeed: 0 diff --git a/Assets/Resources/Prefabs/Games/AnimalAcrobat/WhiteMonkey.prefab b/Assets/Resources/Prefabs/Games/AnimalAcrobat/WhiteMonkey.prefab index b6cd0ddac..91d40645f 100644 --- a/Assets/Resources/Prefabs/Games/AnimalAcrobat/WhiteMonkey.prefab +++ b/Assets/Resources/Prefabs/Games/AnimalAcrobat/WhiteMonkey.prefab @@ -165,6 +165,7 @@ MonoBehaviour: _holdLength: 1 _ease: 10 _holdPadding: 0.25 + _holdPaddingStart: 0 _rotateRoot: {fileID: 2068126119450832752} _gripPoint: {fileID: 8286548847234487440} --- !u!114 &3772265357728581139 @@ -181,6 +182,7 @@ MonoBehaviour: m_EditorClassIdentifier: _monkey: {fileID: 3408415209414813745} _holdLength: 1 + _holdParticle: {fileID: 6823341616428808818} --- !u!1 &3823740494665398411 GameObject: m_ObjectHideFlags: 0 @@ -626,3 +628,8 @@ Animator: m_CorrespondingSourceObject: {fileID: 6945261984245565766, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3} m_PrefabInstance: {fileID: 5705947929937584503} m_PrefabAsset: {fileID: 0} +--- !u!198 &6823341616428808818 stripped +ParticleSystem: + m_CorrespondingSourceObject: {fileID: 1269725258759199493, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3} + m_PrefabInstance: {fileID: 5705947929937584503} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Resources/Prefabs/Games/AnimalAcrobat/WhiteMonkeys.prefab b/Assets/Resources/Prefabs/Games/AnimalAcrobat/WhiteMonkeys.prefab index 263987e78..8e9ca6e21 100644 --- a/Assets/Resources/Prefabs/Games/AnimalAcrobat/WhiteMonkeys.prefab +++ b/Assets/Resources/Prefabs/Games/AnimalAcrobat/WhiteMonkeys.prefab @@ -1953,6 +1953,7 @@ MonoBehaviour: m_EditorClassIdentifier: _monkey: {fileID: 7753963699734426661} _holdLength: 3 + _holdParticle: {fileID: 1902738374551414374} --- !u!114 &6573424568878642626 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2233,6 +2234,11 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3} +--- !u!198 &1902738374551414374 stripped +ParticleSystem: + m_CorrespondingSourceObject: {fileID: 1269725258759199493, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3} + m_PrefabInstance: {fileID: 862749516297338211} + m_PrefabAsset: {fileID: 0} --- !u!4 &6799377662398989628 stripped Transform: m_CorrespondingSourceObject: {fileID: 6171382744519440479, guid: 8c681a700cd16784580f97e7f10a53e6, type: 3} diff --git a/Assets/Scripts/Games/AnimalAcrobat/AcrobatPlayer.cs b/Assets/Scripts/Games/AnimalAcrobat/AcrobatPlayer.cs index ea589263e..efe5fa800 100644 --- a/Assets/Scripts/Games/AnimalAcrobat/AcrobatPlayer.cs +++ b/Assets/Scripts/Games/AnimalAcrobat/AcrobatPlayer.cs @@ -7,6 +7,9 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat { public class AcrobatPlayer : SuperCurveObject { + [Header("Components")] + [SerializeField] private Transform _scroll; + [SerializeField] private ParticleSystem _releaseParticle, _trailParticle; [Header("Values")] [SerializeField] private float _jumpDistanceStart = 6f; [SerializeField] private float _jumpDistance = 8f; @@ -29,9 +32,15 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat _restY = transform.localPosition.y; } + private void LateUpdate() + { + _trailParticle.transform.eulerAngles = Vector3.zero; + } + private void OnDisable() { StopAllCoroutines(); + _trailParticle.Stop(); } public void Bop() @@ -42,15 +51,29 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat public void JumpBetweenAnimals(double beat, float startPoint) { _anim.Play("PlayerAir", 0, 0); + Jump(beat, 2, startPoint, _jumpDistance, _jumpHeight, _restY); RotateJump(beat, 2); + + SpawnReleaseParticle(); } public void JumpBetweenGiraffe(double beat, float startPoint) { _anim.Play("PlayerAir", 0, 0); + + _trailParticle.Play(); Jump(beat, 4, startPoint, _jumpDistanceGiraffe, _jumpHeightGiraffe, _restY); RotateJump(beat, 4); + + SpawnReleaseParticle(); + } + + private void SpawnReleaseParticle() + { + ParticleSystem spawnedParticle = Instantiate(_releaseParticle, _scroll); + spawnedParticle.transform.position = transform.position; + spawnedParticle.Play(); } public void InitialJump(double beat) diff --git a/Assets/Scripts/Games/AnimalAcrobat/GiraffeInput.cs b/Assets/Scripts/Games/AnimalAcrobat/GiraffeInput.cs index 99b5496ce..e4ba1e605 100644 --- a/Assets/Scripts/Games/AnimalAcrobat/GiraffeInput.cs +++ b/Assets/Scripts/Games/AnimalAcrobat/GiraffeInput.cs @@ -8,6 +8,7 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat public class GiraffeInput : MonoBehaviour { [SerializeField] private Animator _monkey; + [SerializeField] private ParticleSystem _holdParticle; private AcrobatObstacle _mainScript; private AnimalAcrobat _game; @@ -47,6 +48,7 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat _monkey.gameObject.SetActive(true); _monkey.DoScaledAnimationAsync("PlayerHang", 1f, 0.4f); _game.PlayerSetActive(false); + SpawnParticle(); BeatAction.New(this, new List() { new BeatAction.Action(0, delegate {}), @@ -63,6 +65,7 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat _monkey.gameObject.SetActive(true); _monkey.DoScaledAnimationAsync("PlayerHang", 1f, 0.4f); _game.PlayerSetActive(false); + SpawnParticle(); BeatAction.New(this, new List() { new BeatAction.Action(0, delegate {}), @@ -73,6 +76,13 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat }); } + private void SpawnParticle() + { + ParticleSystem spawnedParticle = Instantiate(_holdParticle, transform); + spawnedParticle.transform.position = _holdParticle.transform.position; + spawnedParticle.Play(); + } + private void JustRelease(PlayerActionEvent caller, float state) { SoundByte.PlayOneShotGame("animalAcrobat/giraffeJump"); diff --git a/Assets/Scripts/Games/AnimalAcrobat/ObstacleInput.cs b/Assets/Scripts/Games/AnimalAcrobat/ObstacleInput.cs index 2f9dec014..99983dac5 100644 --- a/Assets/Scripts/Games/AnimalAcrobat/ObstacleInput.cs +++ b/Assets/Scripts/Games/AnimalAcrobat/ObstacleInput.cs @@ -9,6 +9,7 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat { [SerializeField] private Animator _monkey; [SerializeField] private double _holdLength; + [SerializeField] private ParticleSystem _holdParticle; private AcrobatObstacle _mainScript; @@ -42,6 +43,7 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat _monkey.gameObject.SetActive(true); _monkey.DoScaledAnimationAsync("PlayerHang", 1f, 0.4f); _game.PlayerSetActive(false); + SpawnParticle(); BeatAction.New(this, new List() { new BeatAction.Action(0, delegate {}), @@ -58,6 +60,7 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat _monkey.gameObject.SetActive(true); _monkey.DoScaledAnimationAsync("PlayerHang", 1f, 0.4f); _game.PlayerSetActive(false); + SpawnParticle(); BeatAction.New(this, new List() { new BeatAction.Action(0, delegate {}), @@ -68,6 +71,13 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat }); } + private void SpawnParticle() + { + ParticleSystem spawnedParticle = Instantiate(_holdParticle, transform); + spawnedParticle.transform.position = _holdParticle.transform.position; + spawnedParticle.Play(); + } + private void JustRelease(PlayerActionEvent caller, float state) { SoundByte.PlayOneShotGame("animalAcrobat/release");