Fixed some bugs, including one where the game refuses to load a new game. Also migrating a few games to the new Input system. (Read desc)

However the new input system has a bug where if you press with two events eligible for a press, both of them interact. I don't know whether to fix this or not.
This commit is contained in:
Braedon
2022-01-23 02:01:59 -05:00
parent f53570bbae
commit 6ac919a232
16 changed files with 254 additions and 343 deletions

View File

@ -36,11 +36,47 @@ namespace RhythmHeavenMania.Games.Spaceball
Sprite.gameObject.transform.eulerAngles = new Vector3(0, 0, rot);
PlayerActionInit(this.gameObject, startBeat, Spaceball.instance.EligibleHits);
// PlayerActionInit(this.gameObject, startBeat, Spaceball.instance.EligibleHits);
isEligible = true;
}
public override void OnAce()
{
this.Hit();
}
private void Hit()
{
hit = true;
hitBeat = Conductor.instance.songPositionInBeats;
hitPos = Holder.transform.localPosition;
hitRot = Holder.transform.eulerAngles.z;
Jukebox.PlayOneShotGame("spaceball/hit");
randomEndPosX = Random.Range(40f, 55f);
anim.enabled = false;
SpaceballPlayer.instance.Swing(this);
}
private void Miss()
{
Holder.transform.GetChild(0).gameObject.AddComponent<Rotate>().rotateSpeed = -55;
enabled = false;
anim.enabled = false;
Rigidbody2D rb = gameObject.AddComponent<Rigidbody2D>();
rb.bodyType = RigidbodyType2D.Dynamic;
rb.AddForce(transform.up * 1100);
rb.AddForce(transform.right * 400);
rb.gravityScale = 9;
Jukebox.PlayOneShot("miss");
}
private void Update()
{
if (hit)
@ -72,6 +108,18 @@ namespace RhythmHeavenMania.Games.Spaceball
StateCheck(normalizedBeat);
if (PlayerInput.Pressed())
{
if (state.perfect)
{
Hit();
}
else if (state.notPerfect())
{
Miss();
}
}
// too lazy to make a proper fix for this
float endTime = 1.2f;
if (high) endTime = 1.1f;