Fixed ForkLifter hand grab bug

This commit is contained in:
Starpelly
2021-12-23 22:36:16 -05:00
parent aa3f999721
commit d72cb639b3
14 changed files with 1545 additions and 58 deletions

View File

@ -6,7 +6,7 @@ using RhythmHeavenMania.Util;
namespace RhythmHeavenMania.Games.ClappyTrio
{
public class ClappyTrio : MonoBehaviour
public class ClappyTrio : Minigame
{
[SerializeField] private GameObject LionLeft;
private GameObject LionMiddle;
@ -24,7 +24,6 @@ namespace RhythmHeavenMania.Games.ClappyTrio
public bool playerHitLast = false;
public static ClappyTrio instance { get; set; }
private void Awake()
@ -32,6 +31,14 @@ namespace RhythmHeavenMania.Games.ClappyTrio
instance = this;
}
public override void OnGameSwitch()
{
SetFace(0, 0);
SetFace(1, 0);
SetFace(2, 0);
PlayAnimationAll("Idle");
}
private void Start()
{
LionMiddle = Instantiate(LionLeft, LionLeft.transform.parent);
@ -76,12 +83,16 @@ namespace RhythmHeavenMania.Games.ClappyTrio
clapIndex = 0;
isClapping = false;
currentClappingLength = 0;
ClappyTrioPlayer.clapStarted = false;
}
}
}
public void Clap(float beat, float length)
{
ClappyTrioPlayer.clapStarted = true;
ClappyTrioPlayer.canHit = true; // this is technically a lie, this just restores the ability to hit
playerHitLast = false;
isClapping = true;
lastClapStart = beat;
@ -105,14 +116,20 @@ namespace RhythmHeavenMania.Games.ClappyTrio
SetFace(1, 1);
SetFace(2, 1);
}
else
{
SetFace(0, 2);
SetFace(1, 2);
SetFace(2, 0);
}
PlayAnimationAll("Bop");
}
private void PlayAnimationAll(string anim)
{
LionLeft.GetComponent<Animator>().Play(anim, 0, 0);
LionMiddle.GetComponent<Animator>().Play(anim, 0, 0);
LionPlayer.GetComponent<Animator>().Play(anim, 0, 0);
LionLeft.GetComponent<Animator>().Play(anim, -1, 0);
LionMiddle.GetComponent<Animator>().Play(anim, -1, 0);
LionPlayer.GetComponent<Animator>().Play(anim, -1, 0);
}
public void SetFace(int lion, int type)