OnBeatPulse callback added
This commit is contained in:
parent
2d6a61eb03
commit
014bf596a9
|
|
@ -47,6 +47,7 @@ namespace HeavenStudio
|
||||||
[NonSerialized] public bool playOnStart;
|
[NonSerialized] public bool playOnStart;
|
||||||
[NonSerialized] public double startBeat;
|
[NonSerialized] public double startBeat;
|
||||||
[NonSerialized] public GameObject currentGameO;
|
[NonSerialized] public GameObject currentGameO;
|
||||||
|
private Minigame _currentMinigame;
|
||||||
[NonSerialized] public bool autoplay;
|
[NonSerialized] public bool autoplay;
|
||||||
[NonSerialized] public bool canInput = true;
|
[NonSerialized] public bool canInput = true;
|
||||||
[NonSerialized] public RiqEntity currentSection, nextSection;
|
[NonSerialized] public RiqEntity currentSection, nextSection;
|
||||||
|
|
@ -493,6 +494,12 @@ namespace HeavenStudio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cond.songPositionInBeatsAsDouble >= Math.Ceiling(_playStartBeat) + _pulseTally)
|
||||||
|
{
|
||||||
|
if (_currentMinigame != null) _currentMinigame.OnBeatPulse(Math.Ceiling(_playStartBeat) + _pulseTally);
|
||||||
|
_pulseTally++;
|
||||||
|
}
|
||||||
|
|
||||||
float seekTime = 8f;
|
float seekTime = 8f;
|
||||||
//seek ahead to preload games that have assetbundles
|
//seek ahead to preload games that have assetbundles
|
||||||
SeekAheadAndPreload(cond.songPositionInBeatsAsDouble, seekTime);
|
SeekAheadAndPreload(cond.songPositionInBeatsAsDouble, seekTime);
|
||||||
|
|
@ -580,10 +587,15 @@ namespace HeavenStudio
|
||||||
|
|
||||||
#region Play Events
|
#region Play Events
|
||||||
|
|
||||||
|
private double _playStartBeat = 0;
|
||||||
|
private int _pulseTally = 0;
|
||||||
|
|
||||||
public void Play(double beat, float delay = 0f)
|
public void Play(double beat, float delay = 0f)
|
||||||
{
|
{
|
||||||
bool paused = Conductor.instance.isPaused;
|
bool paused = Conductor.instance.isPaused;
|
||||||
Debug.Log("Playing at " + beat);
|
Debug.Log("Playing at " + beat);
|
||||||
|
_playStartBeat = beat;
|
||||||
|
_pulseTally = 0;
|
||||||
canInput = true;
|
canInput = true;
|
||||||
if (!paused)
|
if (!paused)
|
||||||
{
|
{
|
||||||
|
|
@ -951,6 +963,10 @@ namespace HeavenStudio
|
||||||
Destroy(currentGameO);
|
Destroy(currentGameO);
|
||||||
|
|
||||||
currentGameO = Instantiate(GetGame(game));
|
currentGameO = Instantiate(GetGame(game));
|
||||||
|
if (currentGameO.TryGetComponent<Minigame>(out var minigame))
|
||||||
|
{
|
||||||
|
_currentMinigame = minigame;
|
||||||
|
}
|
||||||
currentGameO.transform.parent = eventCaller.GamesHolder.transform;
|
currentGameO.transform.parent = eventCaller.GamesHolder.transform;
|
||||||
currentGameO.name = game;
|
currentGameO.name = game;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -412,6 +412,12 @@ namespace HeavenStudio.Games
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mainly for bopping logic
|
||||||
|
public virtual void OnBeatPulse(double beat)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static MultiSound PlaySoundSequence(string game, string name, double startBeat, params SoundSequence.SequenceParams[] args)
|
public static MultiSound PlaySoundSequence(string game, string name, double startBeat, params SoundSequence.SequenceParams[] args)
|
||||||
{
|
{
|
||||||
Minigames.Minigame gameInfo = GameManager.instance.GetGameInfo(game);
|
Minigames.Minigame gameInfo = GameManager.instance.GetGameInfo(game);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue