From 342715e460ab825641330a5a3238aa6c19813bff Mon Sep 17 00:00:00 2001 From: Carson Kompon Date: Mon, 28 Feb 2022 12:32:08 -0500 Subject: [PATCH] Fork now only holds up to 4 peas in Fork Lifter The commit looks a lot larger than it is. I just wrapped it all in an if statement --- Assets/Scripts/Games/ForkLifter/Pea.cs | 59 ++++++++++++++------------ 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/Assets/Scripts/Games/ForkLifter/Pea.cs b/Assets/Scripts/Games/ForkLifter/Pea.cs index d8f7e45b..c109c3b1 100644 --- a/Assets/Scripts/Games/ForkLifter/Pea.cs +++ b/Assets/Scripts/Games/ForkLifter/Pea.cs @@ -47,36 +47,39 @@ namespace RhythmHeavenMania.Games.ForkLifter { ForkLifterPlayer.instance.Stab(this); - GameObject pea = new GameObject(); - - pea.transform.parent = ForkLifterPlayer.instance.perfect.transform; - pea.transform.localScale = Vector2.one; - pea.transform.localRotation = Quaternion.Euler(0, 0, 0); - - pea.transform.localPosition = Vector3.zero; - - for (int i = 0; i < ForkLifterPlayer.instance.perfect.transform.childCount; i++) + if (ForkLifterPlayer.instance.currentPerfectPeasOnFork < 4) { - ForkLifterPlayer.instance.perfect.transform.GetChild(i).transform.localPosition = new Vector3(0, (-1.67f - (0.15724f * i)) + 0.15724f * ForkLifterPlayer.instance.currentPerfectPeasOnFork); - } + GameObject pea = new GameObject(); - SpriteRenderer psprite = pea.AddComponent(); - psprite.sprite = ForkLifter.instance.peaHitSprites[type]; - psprite.sortingOrder = 20; - switch (type) - { - case 0: - psprite.sortingOrder = 101; - break; - case 1: - psprite.sortingOrder = 104; - break; - case 2: - psprite.sortingOrder = 103; - break; - case 3: - psprite.sortingOrder = 102; - break; + pea.transform.parent = ForkLifterPlayer.instance.perfect.transform; + pea.transform.localScale = Vector2.one; + pea.transform.localRotation = Quaternion.Euler(0, 0, 0); + + pea.transform.localPosition = Vector3.zero; + + for (int i = 0; i < ForkLifterPlayer.instance.perfect.transform.childCount; i++) + { + ForkLifterPlayer.instance.perfect.transform.GetChild(i).transform.localPosition = new Vector3(0, (-1.67f - (0.15724f * i)) + 0.15724f * ForkLifterPlayer.instance.currentPerfectPeasOnFork); + } + + SpriteRenderer psprite = pea.AddComponent(); + psprite.sprite = ForkLifter.instance.peaHitSprites[type]; + psprite.sortingOrder = 20; + switch (type) + { + case 0: + psprite.sortingOrder = 101; + break; + case 1: + psprite.sortingOrder = 104; + break; + case 2: + psprite.sortingOrder = 103; + break; + case 3: + psprite.sortingOrder = 102; + break; + } } GameObject hitFXo = new GameObject();