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

@ -52,11 +52,12 @@ namespace RhythmHeavenMania.Games.Spaceball
private void Start()
{
allCameraEvents = EventCaller.GetAllInGameManagerList("spaceball", new string[] { "cameraZoom" });
GameManager.instance.GameCamera.transform.localPosition = new Vector3(0, 0, -10);
}
private void Update()
{
try
/*try
{
var allPlayerActions = EventCaller.GetAllPlayerEntities("spaceball");
int currentPlayerEvent = GameManager.instance.currentPlayerEvent - EventCaller.GetAllPlayerEntitiesExceptBeforeBeat("spaceball", Conductor.instance.songPositionInBeats).Count;
@ -100,7 +101,7 @@ namespace RhythmHeavenMania.Games.Spaceball
catch (System.Exception ex)
{
// this technically isn't game breaking so oh well
}
}*/
}
private void UpdateCameraZoom()

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;

View File

@ -43,7 +43,7 @@ namespace RhythmHeavenMania.Games.Spaceball
if (PlayerInput.Pressed())
{
Swing();
Swing(null);
}
}
@ -53,55 +53,16 @@ namespace RhythmHeavenMania.Games.Spaceball
anim.Play("Idle", 0, 0);
}
public void Swing()
public void Swing(SpaceballBall b)
{
var EligibleHits = Spaceball.instance.EligibleHits;
bool canHit = (Spaceball.instance.EligibleHits.Count > 0) && (currentHitInList < Spaceball.instance.EligibleHits.Count);
int events = Spaceball.instance.MultipleEventsAtOnce();
for (int eventI = 0; eventI < events; eventI++)
if (b == null)
{
if (canHit)
{
SpaceballBall ball = EligibleHits[currentHitInList].gameObject.GetComponent<SpaceballBall>();
if (EligibleHits[currentHitInList].perfect)
{
ball.hit = true;
ball.hitBeat = Conductor.instance.songPositionInBeats;
ball.hitPos = ball.Holder.transform.localPosition;
ball.hitRot = ball.Holder.transform.eulerAngles.z;
Jukebox.PlayOneShotGame("spaceball/hit");
ball.randomEndPosX = Random.Range(40f, 55f);
ball.anim.enabled = false;
}
else if (EligibleHits[currentHitInList].late || EligibleHits[currentHitInList].early)
{
ball.Holder.transform.GetChild(0).gameObject.AddComponent<Rotate>().rotateSpeed = -55;
ball.enabled = false;
ball.anim.enabled = false;
Rigidbody2D rb = ball.gameObject.AddComponent<Rigidbody2D>();
rb.bodyType = RigidbodyType2D.Dynamic;
rb.AddForce(transform.up * 1100);
rb.AddForce(transform.right * 400);
rb.gravityScale = 9;
Jukebox.PlayOneShot("miss");
}
ball.RemoveObject(currentHitInList);
}
}
if (!canHit)
Jukebox.PlayOneShotGame("spaceball/swing");
}
else
{
}
anim.Play("Swing", 0, 0);
}