Fixed AudioSource.time bug, check Conductor.cs for comment.

This commit is contained in:
Starpelly
2021-12-26 23:48:39 -05:00
parent 4b3bfeda1b
commit ff6bce2806
16 changed files with 413 additions and 25 deletions

View File

@ -4,6 +4,8 @@ using UnityEngine;
using Starpelly;
// I CANNOT STRESS THIS ENOUGH, SET "Project Settings/Audio/DSP Buffer Size" to "Best latency" or else AudioSource.time WILL NOT update every frame.
namespace RhythmHeavenMania
{
[RequireComponent(typeof(AudioSource))]
@ -71,7 +73,7 @@ namespace RhythmHeavenMania
// musicSource.Play();
}
void Update()
public void Update()
{
// Conductor.instance.musicSource.pitch = Time.timeScale;
@ -99,9 +101,8 @@ namespace RhythmHeavenMania
public float GetLoopPositionFromBeat(float startBeat, float length)
{
float final = Starpelly.Mathp.Normalize(songPositionInBeats, startBeat, startBeat + length);
return final;
float a = Mathp.Normalize(songPositionInBeats, startBeat, startBeat + length);
return a;
}
public void SetBpm(float bpm)

View File

@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 50
executionOrder: -20
icon: {instanceID: 0}
userData:
assetBundleName:

View File

@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 150
executionOrder: -8
icon: {instanceID: 0}
userData:
assetBundleName:

View File

@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 100
executionOrder: -10
icon: {instanceID: 0}
userData:
assetBundleName:

View File

@ -112,7 +112,13 @@ namespace RhythmHeavenMania.Games.ClappyTrio
{
SetFace(i, 4);
Lion[i].GetComponent<Animator>().Play("Clap", 0, 0);
Jukebox.PlayOneShotGame("clappyTrio/leftClap");
// lazy fix rn
if (i > 0)
Jukebox.PlayOneShotGame("clappyTrio/middleClap");
else
Jukebox.PlayOneShotGame("clappyTrio/leftClap");
clapIndex++;
}
break;

View File

@ -32,12 +32,17 @@ namespace RhythmHeavenMania.Games.Spaceball
float beatLength = 1f;
if (high) beatLength = 2f;
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatLength + 0.2f);
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatLength + 0.15f);
print(normalizedBeatAnim + " " + Time.frameCount);
if (high)
if (high)
{
anim.Play("BallHigh", 0, normalizedBeatAnim);
else
}
else
{
anim.Play("BallLow", 0, normalizedBeatAnim);
}
anim.speed = 0;

View File

@ -37,6 +37,7 @@ namespace RhythmHeavenMania.Games.Spaceball
anim = GetComponent<Animator>();
}
int bruh;
private void Update()
{
if (EligibleHits.Count == 0)
@ -46,6 +47,12 @@ namespace RhythmHeavenMania.Games.Spaceball
{
Swing();
}
if (Conductor.instance.songPositionInBeats >= 5f && bruh == 0)
{
Swing();
bruh++;
}
}
public void SetCostume(int costume)

View File

@ -6,9 +6,8 @@ namespace RhythmHeavenMania.Tests
{
public class WTF : MonoBehaviour
{
// Start is called before the first frame update
void Start()
private void FixedUpdate()
{
}
}
}
}