You can now press whenever you want on Space Soccer

This commit is contained in:
Braedon
2022-02-01 20:11:42 -05:00
parent 919320470b
commit a7c1359f97
9 changed files with 143 additions and 42 deletions

View File

@ -18,9 +18,11 @@ namespace RhythmHeavenMania
public float secPerBeat;
// Current song position, in seconds
private float songPos; // for Conductor use only
public float songPosition;
// Current song position, in beats
private float songPosBeat; // for Conductor use only
public float songPositionInBeats;
// Current time of the song
@ -76,7 +78,7 @@ namespace RhythmHeavenMania
public void Play(float beat)
{
this.time = GetSongPosFromBeat(beat);
songPositionInBeats = GetSongPosFromBeat(beat) / secPerBeat;
songPosBeat = GetSongPosFromBeat(beat) / secPerBeat;
isPlaying = true;
isPaused = false;
@ -101,11 +103,13 @@ namespace RhythmHeavenMania
public void Stop(float time)
{
this.time = time;
songPositionInBeats = time / secPerBeat;
songPosBeat = 0;
songPositionInBeats = 0;
isPlaying = false;
isPaused = false;
musicSource.Stop();
}
float test;
@ -116,11 +120,13 @@ namespace RhythmHeavenMania
if (isPlaying)
{
time += Time.deltaTime * musicSource.pitch;
time += Time.unscaledDeltaTime * musicSource.pitch;
songPosition = time - firstBeatOffset;
songPos = time;
songPosition = songPos;
songPositionInBeats += ((Time.deltaTime * musicSource.pitch) - firstBeatOffset) / secPerBeat;
songPosBeat += ((Time.unscaledDeltaTime * musicSource.pitch) / secPerBeat);
songPositionInBeats = songPosBeat;
// songPositionInBeats = Time.deltaTime / secPerBeat;
if (metronome)