Fixed a space soccer bug that slowly desyncs

This commit is contained in:
Braedon 2022-01-26 17:23:18 -05:00
parent 8268936e6d
commit 197fbbeb7d
2 changed files with 8 additions and 3 deletions

View file

@ -22,7 +22,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
[Header("Properties")] [Header("Properties")]
public float dispensedBeat = 0; public float dispensedBeat = 0;
public bool dispensing; public bool dispensing;
public int hitTimes; public float hitTimes;
private float lastSpriteRot; private float lastSpriteRot;
public bool canKick; public bool canKick;
public GameEvent kicked = new GameEvent(); public GameEvent kicked = new GameEvent();
@ -38,8 +38,8 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
dispensing = false; dispensing = false;
kicked.enabled = true; kicked.enabled = true;
kicked.startBeat = Conductor.instance.songPositionInBeats; // kicked.startBeat = Conductor.instance.songPositionInBeats;
// kicked.startBeat = dispensedBeat + 2 + hitTimes; kicked.startBeat = dispensedBeat + 2 + hitTimes;
hitTimes++; hitTimes++;
@ -58,6 +58,8 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
public void HighKick() public void HighKick()
{ {
hitTimes += 1.5f;
lastSpriteRot = spriteHolder.transform.eulerAngles.z; lastSpriteRot = spriteHolder.transform.eulerAngles.z;
dispensing = false; dispensing = false;
@ -70,6 +72,8 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
public void Toe() public void Toe()
{ {
hitTimes += 1.5f;
lastSpriteRot = spriteHolder.transform.eulerAngles.z; lastSpriteRot = spriteHolder.transform.eulerAngles.z;
highKicked.enabled = false; highKicked.enabled = false;

View file

@ -171,6 +171,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
{ {
if ((highKicks[i].beat - 0.15f) <= Conductor.instance.songPositionInBeats && highKicks[i].beat + 1f > Conductor.instance.songPositionInBeats) if ((highKicks[i].beat - 0.15f) <= Conductor.instance.songPositionInBeats && highKicks[i].beat + 1f > Conductor.instance.songPositionInBeats)
{ {
print("bruh");
canHighKick = true; canHighKick = true;
canKick = false; canKick = false;
break; break;