Bop Refactor + Tweaks/Fixes (#582)

* blue bear tweaks

* OnBeatPulse callback added

* Fixing humming bug in BM + Metronome fix + Some games conversion to onbeatpulse

* clappy trio to drumming practice

* rest of the games converted

* two minor changes
This commit is contained in:
Rapandrasmus
2023-11-23 17:19:39 +01:00
committed by GitHub
parent a96879db8b
commit 9c37ec4216
36 changed files with 365 additions and 374 deletions

View File

@ -47,6 +47,7 @@ namespace HeavenStudio
[NonSerialized] public bool playOnStart;
[NonSerialized] public double startBeat;
[NonSerialized] public GameObject currentGameO;
private Minigame _currentMinigame;
[NonSerialized] public bool autoplay;
[NonSerialized] public bool canInput = true;
[NonSerialized] public RiqEntity currentSection, nextSection;
@ -70,6 +71,7 @@ namespace HeavenStudio
public event Action<double> onBeatChanged;
public event Action<RiqEntity> onSectionChange;
public event Action<double> onBeatPulse;
public int BeatmapEntities()
{
@ -493,6 +495,13 @@ namespace HeavenStudio
}
}
if (cond.songPositionInBeatsAsDouble >= Math.Ceiling(_playStartBeat) + _pulseTally)
{
if (_currentMinigame != null) _currentMinigame.OnBeatPulse(Math.Ceiling(_playStartBeat) + _pulseTally);
onBeatPulse?.Invoke(Math.Ceiling(_playStartBeat) + _pulseTally);
_pulseTally++;
}
float seekTime = 8f;
//seek ahead to preload games that have assetbundles
SeekAheadAndPreload(cond.songPositionInBeatsAsDouble, seekTime);
@ -580,10 +589,15 @@ namespace HeavenStudio
#region Play Events
private double _playStartBeat = 0;
private int _pulseTally = 0;
public void Play(double beat, float delay = 0f)
{
bool paused = Conductor.instance.isPaused;
Debug.Log("Playing at " + beat);
_playStartBeat = beat;
_pulseTally = 0;
canInput = true;
if (!paused)
{
@ -951,6 +965,10 @@ namespace HeavenStudio
Destroy(currentGameO);
currentGameO = Instantiate(GetGame(game));
if (currentGameO.TryGetComponent<Minigame>(out var minigame))
{
_currentMinigame = minigame;
}
currentGameO.transform.parent = eventCaller.GamesHolder.transform;
currentGameO.name = game;