diff --git a/Assets/Scripts/Conductor.cs b/Assets/Scripts/Conductor.cs index 0ec70500b..322924be2 100644 --- a/Assets/Scripts/Conductor.cs +++ b/Assets/Scripts/Conductor.cs @@ -82,6 +82,7 @@ namespace HeavenStudio // Metronome tick sound enabled public bool metronome = false; Util.Sound metronomeSound; + private int _metronomeTally = 0; // pitch values private float timelinePitch = 1f; @@ -204,6 +205,7 @@ namespace HeavenStudio songPosBeat = GetBeatFromSongPos(time); startBeat = songPosBeat; + _metronomeTally = 0; startTime = DateTime.Now; absTimeAdjust = 0; @@ -363,13 +365,10 @@ namespace HeavenStudio { if (metronome && isPlaying) { - if (ReportBeat(ref lastReportedBeat)) + if (songPositionInBeatsAsDouble >= Math.Ceiling(startBeat) + _metronomeTally) { - metronomeSound = Util.SoundByte.PlayOneShot("metronome", lastReportedBeat); - } - else if (songPositionInBeats < lastReportedBeat) - { - lastReportedBeat = Mathf.Round(songPositionInBeats); + metronomeSound = Util.SoundByte.PlayOneShot("metronome", Math.Ceiling(startBeat) + _metronomeTally); + _metronomeTally++; } } else diff --git a/Assets/Scripts/Games/BoardMeeting/BMExecutive.cs b/Assets/Scripts/Games/BoardMeeting/BMExecutive.cs index 560180489..6e4577760 100644 --- a/Assets/Scripts/Games/BoardMeeting/BMExecutive.cs +++ b/Assets/Scripts/Games/BoardMeeting/BMExecutive.cs @@ -22,6 +22,14 @@ namespace HeavenStudio.Games.Scripts_BoardMeeting game = BoardMeeting.instance; } + private void OnDestroy() + { + if (rollLoop != null) + { + rollLoop.Stop(); + } + } + public void Prepare() { if (spinning) return; @@ -78,7 +86,7 @@ namespace HeavenStudio.Games.Scripts_BoardMeeting public void Bop() { - if (!canBop || spinning || !anim.IsAnimationNotPlaying() || preparing) return; + if (!canBop || spinning || preparing) return; if (smileCounter > 0) { anim.DoScaledAnimationAsync("SmileBop", 0.5f); diff --git a/Assets/Scripts/Games/BoardMeeting/BoardMeeting.cs b/Assets/Scripts/Games/BoardMeeting/BoardMeeting.cs index f5efe82e0..845e6d2c1 100644 --- a/Assets/Scripts/Games/BoardMeeting/BoardMeeting.cs +++ b/Assets/Scripts/Games/BoardMeeting/BoardMeeting.cs @@ -92,8 +92,8 @@ namespace HeavenStudio.Games public BMExecutive firstSpinner; [SerializeField] float shakeIntensity = 0.5f; public bool shouldBop = true; - bool assistantCanBop = true; - bool executivesCanBop = true; + private bool assistantCanBop = true; + private bool executivesCanBop = true; public GameEvent bop = new GameEvent(); [NonSerialized] public Sound chairLoopSound = null; int missCounter = 0; @@ -126,10 +126,6 @@ namespace HeavenStudio.Games if (cond.isPlaying && !cond.isPaused) { - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop) - { - SingleBop(); - } if (PlayerInput.GetIsAction(InputAction_BasicPressing) && !IsExpectingInputNow(InputAction_BasicPress.inputLockCategory)) { if (executives[executiveCount - 1].spinning) @@ -147,6 +143,12 @@ namespace HeavenStudio.Games } } + public override void OnBeatPulse(double beat) + { + if (!shouldBop) return; + SingleBop(); + } + void SingleBop() { if (assistantCanBop) diff --git a/Assets/Scripts/Games/CatchyTune/CatchyTune.cs b/Assets/Scripts/Games/CatchyTune/CatchyTune.cs index 9fca5387c..5f2503024 100644 --- a/Assets/Scripts/Games/CatchyTune/CatchyTune.cs +++ b/Assets/Scripts/Games/CatchyTune/CatchyTune.cs @@ -208,13 +208,13 @@ namespace HeavenStudio.Games // print("current beat: " + conductor.songPositionInBeatsAsDouble); if (stopCatchLeft > 0 && stopCatchLeft <= cond.songPositionInBeatsAsDouble) { - plalinAnim.Play("idle", 0, 0); + plalinAnim.DoScaledAnimationAsync("idle", 0.5f); stopCatchLeft = 0; } if (stopCatchRight > 0 && stopCatchRight <= cond.songPositionInBeatsAsDouble) { - alalinAnim.Play("idle", 0, 0); + alalinAnim.DoScaledAnimationAsync("idle", 0.5f); stopCatchRight = 0; } @@ -236,19 +236,6 @@ namespace HeavenStudio.Games heartMessage.SetActive(false); } - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (bopLeft && stopCatchLeft == 0) - { - plalinAnim.Play("bop", 0, 0); - } - - if (bopRight && stopCatchRight == 0) - { - alalinAnim.Play("bop", 0, 0); - } - } - if (PlayerInput.GetIsAction(InputAction_Left) && !IsExpectingInputNow(InputAction_Left.inputLockCategory)) { catchWhiff(false); @@ -260,6 +247,19 @@ namespace HeavenStudio.Games } } + public override void OnBeatPulse(double beat) + { + if (bopLeft && stopCatchLeft == 0) + { + plalinAnim.DoScaledAnimationAsync("bop", 0.5f); + } + + if (bopRight && stopCatchRight == 0) + { + alalinAnim.DoScaledAnimationAsync("bop", 0.5f); + } + } + public void DropFruit(double beat, int side, bool smile, bool isPineapple, float endSmile) { var objectToSpawn = isPineapple ? pineappleBase : orangeBase; @@ -344,23 +344,23 @@ namespace HeavenStudio.Games case (int)WhoBops.Plalin: if (stopCatchLeft == 0) { - plalinAnim.Play("bop", 0, 0); + plalinAnim.DoScaledAnimationAsync("bop", 0.5f); } break; case (int)WhoBops.Alalin: if (stopCatchRight == 0) { - alalinAnim.Play("bop", 0, 0); + alalinAnim.DoScaledAnimationAsync("bop", 0.5f); } break; case (int)WhoBops.Both: if (stopCatchRight == 0) { - alalinAnim.Play("bop", 0, 0); + alalinAnim.DoScaledAnimationAsync("bop", 0.5f); } if (stopCatchLeft == 0) { - plalinAnim.Play("bop", 0, 0); + plalinAnim.DoScaledAnimationAsync("bop", 0.5f); } break; default: @@ -374,12 +374,12 @@ namespace HeavenStudio.Games if (side) { - alalinAnim.Play(anim, 0, 0); + alalinAnim.DoScaledAnimationAsync(anim, 0.5f); stopCatchRight = beat + 0.9f; } else { - plalinAnim.Play(anim, 0, 0); + plalinAnim.DoScaledAnimationAsync(anim, 0.5f); stopCatchLeft = beat + 0.9f; } @@ -402,12 +402,12 @@ namespace HeavenStudio.Games if (side) { - alalinAnim.Play("miss" + fruitType, 0, 0); + alalinAnim.DoScaledAnimationAsync("miss" + fruitType, 0.5f); stopCatchRight = beat + 0.7f; } else { - plalinAnim.Play("miss" + fruitType, 0, 0); + plalinAnim.DoScaledAnimationAsync("miss" + fruitType, 0.5f); stopCatchLeft = beat + 0.7f; } } @@ -438,12 +438,12 @@ namespace HeavenStudio.Games if (side) { - alalinAnim.Play("whiff", 0, 0); + alalinAnim.DoScaledAnimationAsync("whiff", 0.5f); stopCatchRight = beat + 0.5f; } else { - plalinAnim.Play("whiff", 0, 0); + plalinAnim.DoScaledAnimationAsync("whiff", 0.5f); stopCatchLeft = beat + 0.5f; } } diff --git a/Assets/Scripts/Games/CheerReaders/CheerReaders.cs b/Assets/Scripts/Games/CheerReaders/CheerReaders.cs index c04ee4bb6..0af61ec29 100644 --- a/Assets/Scripts/Games/CheerReaders/CheerReaders.cs +++ b/Assets/Scripts/Games/CheerReaders/CheerReaders.cs @@ -262,13 +262,15 @@ namespace HeavenStudio.Games UpdateCameraZoom(); } + public override void OnBeatPulse(double beat) + { + if (!shouldBop) return; + BopSingle(); + } + void Update() { var cond = Conductor.instance; - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop) - { - BopSingle(); - } if (cond.isPlaying && !cond.isPaused) {