Merge pull request #23 from CarsonKompon/fix-fork-lifter-maximum-peas-on-fork

Fork now only holds up to 4 peas in Fork Lifter
This commit is contained in:
Jenny Crowe 2022-02-28 14:11:29 -07:00 committed by GitHub
commit 51c4e01889

View file

@ -47,36 +47,39 @@ namespace RhythmHeavenMania.Games.ForkLifter
{ {
ForkLifterPlayer.instance.Stab(this); ForkLifterPlayer.instance.Stab(this);
GameObject pea = new GameObject(); if (ForkLifterPlayer.instance.currentPerfectPeasOnFork < 4)
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); GameObject pea = new GameObject();
}
SpriteRenderer psprite = pea.AddComponent<SpriteRenderer>(); pea.transform.parent = ForkLifterPlayer.instance.perfect.transform;
psprite.sprite = ForkLifter.instance.peaHitSprites[type]; pea.transform.localScale = Vector2.one;
psprite.sortingOrder = 20; pea.transform.localRotation = Quaternion.Euler(0, 0, 0);
switch (type)
{ pea.transform.localPosition = Vector3.zero;
case 0:
psprite.sortingOrder = 101; for (int i = 0; i < ForkLifterPlayer.instance.perfect.transform.childCount; i++)
break; {
case 1: ForkLifterPlayer.instance.perfect.transform.GetChild(i).transform.localPosition = new Vector3(0, (-1.67f - (0.15724f * i)) + 0.15724f * ForkLifterPlayer.instance.currentPerfectPeasOnFork);
psprite.sortingOrder = 104; }
break;
case 2: SpriteRenderer psprite = pea.AddComponent<SpriteRenderer>();
psprite.sortingOrder = 103; psprite.sprite = ForkLifter.instance.peaHitSprites[type];
break; psprite.sortingOrder = 20;
case 3: switch (type)
psprite.sortingOrder = 102; {
break; 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(); GameObject hitFXo = new GameObject();