diff --git a/Assets/Resources/Sfx/games/blueBear/whiff.wav b/Assets/Resources/Sfx/games/blueBear/whiff.wav index 3dec6f93b..5c6bbd899 100644 Binary files a/Assets/Resources/Sfx/games/blueBear/whiff.wav and b/Assets/Resources/Sfx/games/blueBear/whiff.wav differ diff --git a/Assets/Resources/Sfx/games/blueBear/whiff.wav.meta b/Assets/Resources/Sfx/games/blueBear/whiff.wav.meta index 1ccc70674..f297b90b7 100644 --- a/Assets/Resources/Sfx/games/blueBear/whiff.wav.meta +++ b/Assets/Resources/Sfx/games/blueBear/whiff.wav.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2448776798073114dbaa07b1c4a83cd8 +guid: b570a8e729c2e6c47bfe22048bcc0e8c AudioImporter: externalObjects: {} serializedVersion: 6 @@ -18,5 +18,5 @@ AudioImporter: ambisonic: 0 3D: 1 userData: - assetBundleName: + assetBundleName: ctrbear/common assetBundleVariant: diff --git a/Assets/Scripts/Conductor.cs b/Assets/Scripts/Conductor.cs index 0ec70500b..c32069a53 100644 --- a/Assets/Scripts/Conductor.cs +++ b/Assets/Scripts/Conductor.cs @@ -76,12 +76,10 @@ namespace HeavenStudio // Conductor is currently paused, but not fully stopped public bool isPaused; - // Last reported beat based on song position - private double lastReportedBeat = 0f; - // Metronome tick sound enabled public bool metronome = false; Util.Sound metronomeSound; + private int _metronomeTally = 0; // pitch values private float timelinePitch = 1f; @@ -204,6 +202,7 @@ namespace HeavenStudio songPosBeat = GetBeatFromSongPos(time); startBeat = songPosBeat; + _metronomeTally = 0; startTime = DateTime.Now; absTimeAdjust = 0; @@ -363,13 +362,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 @@ -382,6 +378,7 @@ namespace HeavenStudio } } + [Obsolete("Conductor.ReportBeat is deprecated. Please use the OnBeatPulse callback instead.")] public bool ReportBeat(ref double lastReportedBeat, double offset = 0, bool shiftBeatToOffset = true) { bool result = songPositionInBeats + (shiftBeatToOffset ? offset : 0f) >= (lastReportedBeat) + 1f; diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 1496704e5..483430651 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -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 onBeatChanged; public event Action onSectionChange; + public event Action 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(out var minigame)) + { + _currentMinigame = minigame; + } currentGameO.transform.parent = eventCaller.GamesHolder.transform; currentGameO.name = game; diff --git a/Assets/Scripts/Games/BlueBear/BlueBear.cs b/Assets/Scripts/Games/BlueBear/BlueBear.cs index db5795390..3d908c539 100644 --- a/Assets/Scripts/Games/BlueBear/BlueBear.cs +++ b/Assets/Scripts/Games/BlueBear/BlueBear.cs @@ -126,9 +126,9 @@ namespace HeavenStudio.Games public GameObject individualBagHolder; [Header("Variables")] - static int rightCrumbAppearThreshold = 15; - static int leftCrumbAppearThreshold = 30; - static int eatenTreats = 0; + private int rightCrumbAppearThreshold = 15; + private int leftCrumbAppearThreshold = 30; + private int eatenTreats = 0; bool crying; private List _allStoryEvents = new(); [SerializeField] private SuperCurveObject.Path[] _treatCurves; @@ -236,7 +236,6 @@ namespace HeavenStudio.Games private void Awake() { instance = this; - if (Conductor.instance.isPlaying || Conductor.instance.isPaused) EatTreat(true); _allStoryEvents = EventCaller.GetAllInGameManagerList("blueBear", new string[] { "story" }); UpdateStory(); } @@ -292,12 +291,12 @@ namespace HeavenStudio.Games if (PlayerInput.GetIsAction(InputAction_Left) && !IsExpectingInputNow(InputAction_Left.inputLockCategory)) { - SoundByte.PlayOneShotGame("blueBear/whiff"); + SoundByte.PlayOneShotGame("blueBear/whiff", -1, SoundByte.GetPitchFromSemiTones(UnityEngine.Random.Range(-1, 2), false)); Bite(true); } else if (PlayerInput.GetIsAction(InputAction_Right) && !IsExpectingInputNow(InputAction_Right.inputLockCategory)) { - SoundByte.PlayOneShotGame("blueBear/whiff"); + SoundByte.PlayOneShotGame("blueBear/whiff", -1, SoundByte.GetPitchFromSemiTones(UnityEngine.Random.Range(-1, 2), false)); Bite(false); } @@ -373,12 +372,14 @@ namespace HeavenStudio.Games { HandleTreatsOnStart(beat); HandleEmotions(beat); + HandleCrumbs(beat); } public override void OnGameSwitch(double beat) { HandleTreatsOnStart(beat); HandleEmotions(beat); + HandleCrumbs(beat); } private void HandleTreatsOnStart(double gameswitchBeat) @@ -412,6 +413,15 @@ namespace HeavenStudio.Games } } + private void HandleCrumbs(double beat) + { + var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("blueBear", new string[] { "crumb" }).FindAll(x => x.beat < beat); + if (allEventsBeforeBeat.Count == 0) return; + var lastCrumbEvent = allEventsBeforeBeat[^1]; + SetCrumbThreshold(lastCrumbEvent["right"], lastCrumbEvent["left"], lastCrumbEvent["reset"]); + EatTreat(false); + } + public void SetCrumbThreshold(int rightThreshold, int leftThreshold, bool reset) { rightCrumbAppearThreshold = rightThreshold; @@ -419,9 +429,9 @@ namespace HeavenStudio.Games if (reset) eatenTreats = 0; } - public void EatTreat(bool onlyCheck = false) + public void EatTreat(bool appendTreats = true) { - if (!onlyCheck) eatenTreats++; + if (appendTreats) eatenTreats++; if (eatenTreats >= leftCrumbAppearThreshold) { leftCrumb.SetActive(true); 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) { diff --git a/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs b/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs index b78cc9eb3..a3906fec2 100644 --- a/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs +++ b/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs @@ -135,13 +135,14 @@ namespace HeavenStudio.Games } } + public override void OnBeatPulse(double beat) + { + if (shouldBop) Bop(Conductor.instance.songPositionInBeatsAsDouble); + } + void Update() { var cond = Conductor.instance; - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (shouldBop) Bop(cond.songPositionInBeatsAsDouble); - } if (cond.isPlaying && !cond.isPaused) { float normalizedBeat = cond.GetPositionFromBeat(signStartBeat, signLength); diff --git a/Assets/Scripts/Games/DJSchool/DJSchool.cs b/Assets/Scripts/Games/DJSchool/DJSchool.cs index fdc3dcb6e..953c5239d 100644 --- a/Assets/Scripts/Games/DJSchool/DJSchool.cs +++ b/Assets/Scripts/Games/DJSchool/DJSchool.cs @@ -165,95 +165,48 @@ namespace HeavenStudio.Games } } + public override void OnBeatPulse(double beat) + { + if (!goBop) return; + if (student.isHolding) + { + student.anim.DoScaledAnimationAsync("HoldBop", 0.5f); + } + else if (!student.swiping && student.anim.IsAnimationNotPlaying()) + { + student.anim.DoScaledAnimationAsync("IdleBop", 0.5f); + } + + var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0); + if (yellowState.IsName("Hey")) + { + //PostScratchoFace(); + } + if (!andStop && !djYellowHolding) + { + float normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f); + if (normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.Happy); + else if (!djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed)) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.NeutralLeft); + djYellowScript.Reverse(djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed)); + if (djYellowBopLeft) + { + djYellowAnim.DoScaledAnimationAsync("IdleBop2", 0.5f); + } + else + { + djYellowAnim.DoScaledAnimationAsync("IdleBop", 0.5f); + } + djYellowBopLeft = !djYellowBopLeft; + + } + else if (djYellowHolding) + { + djYellowAnim.DoScaledAnimationAsync("HoldBop", 0.5f); + } + } + private void Update() { - #region old script - //var cond = Conductor.instance; - - //if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - //{ - // if (cond.songPositionInBeatsAsDouble >= bop.startBeat && cond.songPositionInBeatsAsDouble < bop.startBeat + bop.length) - // { - // if (student.anim.IsAnimationNotPlaying()) - // { - // if (student.isHolding) - // { - // student.anim.Play("HoldBop", 0, 0); - // } - // else - // { - // student.anim.Play("IdleBop", 0, 0); - // } - // } - // if (djYellowAnim.IsAnimationNotPlaying()) - // { - // var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0); - // if (yellowState.IsName("Hey")) - // { - // PostScratchoFace(); - // } - - // if (djYellowHolding) - // { - // djYellowAnim.Play("HoldBop", 0, 0); - // } - // else - // { - // // todo: split between left and right bop based on beat - // djYellowAnim.Play("IdleBop", 0, 0); - // } - // } - // } - //} - #endregion - - if (Conductor.instance.ReportBeat(ref lastReportedBeat)) - { - if (goBop) - { - if (student.isHolding) - { - student.anim.DoScaledAnimationAsync("HoldBop", 0.5f); - } - else if (!student.swiping && student.anim.IsAnimationNotPlaying()) - { - student.anim.DoScaledAnimationAsync("IdleBop", 0.5f); - } - - var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0); - if (yellowState.IsName("Hey")) - { - //PostScratchoFace(); - } - if (!andStop && !djYellowHolding) - { - float normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f); - if (normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.Happy); - else if (!djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed)) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.NeutralLeft); - djYellowScript.Reverse(djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed)); - if (djYellowBopLeft) - { - djYellowAnim.DoScaledAnimationAsync("IdleBop2", 0.5f); - } - else - { - djYellowAnim.DoScaledAnimationAsync("IdleBop", 0.5f); - } - djYellowBopLeft = !djYellowBopLeft; - - } - else if (djYellowHolding) - { - djYellowAnim.DoScaledAnimationAsync("HoldBop", 0.5f); - } - } - - } - else if (Conductor.instance.songPositionInBeatsAsDouble < lastReportedBeat) - { - lastReportedBeat = Math.Round(Conductor.instance.songPositionInBeatsAsDouble); - } - if(PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress) && !student.isHolding) //Start hold miss { student.OnMissHoldForPlayerInput(); diff --git a/Assets/Scripts/Games/DogNinja/DogNinja.cs b/Assets/Scripts/Games/DogNinja/DogNinja.cs index b14379f2b..388d8a62a 100644 --- a/Assets/Scripts/Games/DogNinja/DogNinja.cs +++ b/Assets/Scripts/Games/DogNinja/DogNinja.cs @@ -17,11 +17,12 @@ namespace HeavenStudio.Games.Loaders { new GameAction("Bop", "Bop") { - function = delegate { DogNinja.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity["toggle"]); }, - defaultLength = 0.5f, + function = delegate { DogNinja.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length, eventCaller.currentEntity["auto"], eventCaller.currentEntity["toggle"]); }, + resizable = true, parameters = new List() { - new Param("toggle", false, "Enable Bopping", "Whether to bop to the beat or not"), + new Param("toggle", true, "Enable Bopping", "Whether to bop to the beat or not"), + new Param("auto", false, "Enable Bopping (Auto)", "Whether to bop to the beat or not automatically"), } }, new GameAction("Prepare", "Prepare") @@ -141,7 +142,7 @@ namespace HeavenStudio.Games private double lastReportedBeat = 0f; private bool birdOnScreen = false; - static bool dontBop = false; + bool dontBop = false; private const string sfxNum = "dogNinja/"; public static DogNinja instance; @@ -213,6 +214,12 @@ namespace HeavenStudio.Games } } + public override void OnBeatPulse(double beat) + { + if (dontBop) return; + DogAnim.DoScaledAnimationAsync("Bop", 0.5f); + } + private void Update() { if (DogAnim.GetBool("needPrepare") && DogAnim.IsAnimationNotPlaying()) @@ -258,17 +265,18 @@ namespace HeavenStudio.Games } } - private void LateUpdate() + public void Bop(double beat, float length, bool auto, bool bop) { - if (Conductor.instance.ReportBeat(ref lastReportedBeat) && DogAnim.IsAnimationNotPlaying() && !dontBop) - { - DogAnim.DoScaledAnimationAsync("Bop", 0.5f); - } - } + dontBop = !auto; + if (!bop) return; + List actions = new(); - public void Bop(double beat, bool bop) - { - dontBop = !bop; + for (int i = 0; i < length; i++) + { + actions.Add(new(beat + i, delegate { DogAnim.DoScaledAnimationAsync("Bop", 0.5f); })); + } + + if (actions.Count > 0) BeatAction.New(this, actions); } public static void QueueObject(double beat, int direction, int typeL, int typeR, bool prepare, bool muteThrow) diff --git a/Assets/Scripts/Games/DoubleDate/DoubleDate.cs b/Assets/Scripts/Games/DoubleDate/DoubleDate.cs index e1f50fb7d..e82f6aa52 100644 --- a/Assets/Scripts/Games/DoubleDate/DoubleDate.cs +++ b/Assets/Scripts/Games/DoubleDate/DoubleDate.cs @@ -138,6 +138,11 @@ namespace HeavenStudio.Games clouds.transform.position = Vector3.left * ((Time.realtimeSinceStartup * cloudSpeed) % cloudDistance); } + public override void OnBeatPulse(double beat) + { + if (shouldBop) SingleBop(); + } + void Update() { var cond = Conductor.instance; @@ -162,10 +167,6 @@ namespace HeavenStudio.Games } queuedBalls.Clear(); } - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop) - { - SingleBop(); - } } else { diff --git a/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs b/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs index 7ae3ddd66..071711e07 100644 --- a/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs +++ b/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs @@ -144,16 +144,17 @@ namespace HeavenStudio.Games PersistColor(beat); } + public override void OnBeatPulse(double beat) + { + if (goBop) + { + Bop(); + } + } + private void Update() { var cond = Conductor.instance; - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (goBop) - { - Bop(); - } - } if (isMoving && cond.isPlaying && !cond.isPaused) { diff --git a/Assets/Scripts/Games/FanClub/FanClub.cs b/Assets/Scripts/Games/FanClub/FanClub.cs index 6defe4d95..bdadd7419 100644 --- a/Assets/Scripts/Games/FanClub/FanClub.cs +++ b/Assets/Scripts/Games/FanClub/FanClub.cs @@ -204,8 +204,6 @@ namespace HeavenStudio.Games private List Spectators; //bop-type animations - private GameEvent bop = new GameEvent(); - private GameEvent specBop = new GameEvent(); private GameEvent noBop = new GameEvent(); private GameEvent noResponse = new GameEvent(); private GameEvent noCall = new GameEvent(); @@ -356,30 +354,28 @@ namespace HeavenStudio.Games } } + public override void OnBeatPulse(double beat) + { + var cond = Conductor.instance; + if (goBopIdol) + { + if (!(cond.songPositionInBeatsAsDouble >= noBop.startBeat && cond.songPositionInBeatsAsDouble < noBop.startBeat + noBop.length)) + { + idolAnimator.Play("IdolBeat" + GetPerformanceSuffix(), 0, 0); + Blue.PlayAnimState("Beat"); + Orange.PlayAnimState("Beat"); + } + } + if (goBopSpec) + { + if (!(cond.songPositionInBeatsAsDouble >= noSpecBop.startBeat && cond.songPositionInBeatsAsDouble < noSpecBop.startBeat + noSpecBop.length)) + BopAll(); + } + } + private void Update() { var cond = Conductor.instance; - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (goBopIdol) - { - if (!(cond.songPositionInBeatsAsDouble >= noBop.startBeat && cond.songPositionInBeatsAsDouble < noBop.startBeat + noBop.length)) - { - idolAnimator.Play("IdolBeat" + GetPerformanceSuffix(), 0, 0); - Blue.PlayAnimState("Beat"); - Orange.PlayAnimState("Beat"); - } - } - } - - if (cond.ReportBeat(ref specBop.lastReportedBeat, specBop.startBeat % 1)) - { - if (goBopSpec) - { - if (!(cond.songPositionInBeatsAsDouble >= noSpecBop.startBeat && cond.songPositionInBeatsAsDouble < noSpecBop.startBeat + noSpecBop.length)) - BopAll(); - } - } //idol jumping physics float jumpPos = cond.GetPositionFromBeat(idolJumpStartTime, 1f); diff --git a/Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs b/Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs index e8eb46f47..3af0b6a5a 100644 --- a/Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs +++ b/Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs @@ -230,16 +230,17 @@ namespace HeavenStudio.Games } } + public override void OnBeatPulse(double beat) + { + if (goBopFlip) SingleBop((int)WhoBops.Flippers); + if (goBopTuck) SingleBop((int)WhoBops.CaptainTuck); + } + private void Update() { var cond = Conductor.instance; if (cond.isPlaying && !cond.isPaused) { - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (goBopFlip) SingleBop((int)WhoBops.Flippers); - if (goBopTuck) SingleBop((int)WhoBops.CaptainTuck); - } if (isWalking) { float normalizedBeat = cond.GetPositionFromBeat(walkStartBeat, walkLength); diff --git a/Assets/Scripts/Games/ForkLifter/ForkLifter.cs b/Assets/Scripts/Games/ForkLifter/ForkLifter.cs index 26e904d00..b615576ab 100644 --- a/Assets/Scripts/Games/ForkLifter/ForkLifter.cs +++ b/Assets/Scripts/Games/ForkLifter/ForkLifter.cs @@ -69,16 +69,6 @@ namespace HeavenStudio.Games.Loaders }, resizable = true }, - new GameAction("bop", "Bop") - { - function = delegate { var e = eventCaller.currentEntity; ForkLifter.instance.Bop(e.beat, e.length, e["bop"], e["autoBop"]); }, - parameters = new List() - { - new Param("bop", true, "Keep Bopping", "Should Fork bop for the duration of the block?"), - new Param("autoBop", false, "Keep Bopping (Auto)", "Should Fork bop indefinitely?"), - }, - resizable = true, - }, }, new List() {"rvl", "normal"}, "rvlfork", "en", diff --git a/Assets/Scripts/Games/ForkLifter/ForkLifterPlayer.cs b/Assets/Scripts/Games/ForkLifter/ForkLifterPlayer.cs index d3eed38de..ec2a95818 100644 --- a/Assets/Scripts/Games/ForkLifter/ForkLifterPlayer.cs +++ b/Assets/Scripts/Games/ForkLifter/ForkLifterPlayer.cs @@ -27,7 +27,6 @@ namespace HeavenStudio.Games.Scripts_ForkLifter public int currentEarlyPeasOnFork; public int currentPerfectPeasOnFork; public int currentLatePeasOnFork; - private double lastReportedBeat; private bool isEating = false; @@ -49,16 +48,6 @@ namespace HeavenStudio.Games.Scripts_ForkLifter { Stab(null); } - - if (Conductor.instance.ReportBeat(ref lastReportedBeat) && anim.IsAnimationNotPlaying() && shouldBop) - { - SingleBop(); - } - } - - public void SingleBop() - { - anim.DoScaledAnimationAsync("Player_Bop", 0.5f); } public void Eat() diff --git a/Assets/Scripts/Games/KarateMan/KarateMan.cs b/Assets/Scripts/Games/KarateMan/KarateMan.cs index 06acb99d0..9fca97f8b 100644 --- a/Assets/Scripts/Games/KarateMan/KarateMan.cs +++ b/Assets/Scripts/Games/KarateMan/KarateMan.cs @@ -1166,6 +1166,11 @@ namespace HeavenStudio.Games Wind.windMain = windStrength; } + public override void OnBeatPulse(double beat) + { + Joe.RequestBop(); + } + public void ToggleBop(double beat, float length, bool toggle, bool autoBop) { Joe.bop.length = autoBop ? float.MaxValue : 0; diff --git a/Assets/Scripts/Games/KarateMan/KarateManJoe.cs b/Assets/Scripts/Games/KarateMan/KarateManJoe.cs index 75f163641..dbc543d38 100644 --- a/Assets/Scripts/Games/KarateMan/KarateManJoe.cs +++ b/Assets/Scripts/Games/KarateMan/KarateManJoe.cs @@ -51,6 +51,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan } public bool inNuriLock { get { return (Conductor.instance.songPositionInBeatsAsDouble >= noNuriJabTime && Conductor.instance.songPositionInBeatsAsDouble < noNuriJabTime + 1f); } } + public void RequestBop() + { + var cond = Conductor.instance; + if (cond.songPositionInBeatsAsDouble > bop.startBeat && cond.songPositionInBeatsAsDouble < bop.startBeat + bop.length && cond.songPositionInBeatsAsDouble >= unPrepareTime && !inCombo) Bop(); + } + private void Update() { var cond = Conductor.instance; @@ -95,11 +101,6 @@ namespace HeavenStudio.Games.Scripts_KarateMan anim.Play("Beat", -1, 0); } - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1, false) && cond.songPositionInBeatsAsDouble > bop.startBeat && cond.songPositionInBeatsAsDouble < bop.startBeat + bop.length && cond.songPositionInBeatsAsDouble >= unPrepareTime && !inCombo) - { - Bop(); - } - if (inCombo && shouldComboId == -2) { float missProg = cond.GetPositionFromBeat(lastComboMissTime, 3f); diff --git a/Assets/Scripts/Games/Lockstep/Lockstep.cs b/Assets/Scripts/Games/Lockstep/Lockstep.cs index f425f735f..fad8de7ff 100644 --- a/Assets/Scripts/Games/Lockstep/Lockstep.cs +++ b/Assets/Scripts/Games/Lockstep/Lockstep.cs @@ -336,18 +336,19 @@ namespace HeavenStudio.Games } } + public override void OnBeatPulse(double beat) + { + if (goBop) + { + PlayStepperAnim("Bop", true, 0.5f); + } + } + private void Update() { var cond = Conductor.instance; if (cond.isPlaying && !cond.isPaused) { - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (goBop) - { - PlayStepperAnim("Bop", true, 0.5f); - } - } if (queuedInputs.Count > 0) { foreach (var input in queuedInputs) diff --git a/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs b/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs index 934b2eab9..f03d79db6 100644 --- a/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs +++ b/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs @@ -157,10 +157,9 @@ namespace HeavenStudio.Games } } - private void LateUpdate() + public override void OnBeatPulse(double beat) { - if (Conductor.instance.ReportBeat(ref lastReportedBeat) - && !BossAnim.IsPlayingAnimationName("BossCall") + if (!BossAnim.IsPlayingAnimationName("BossCall") && !BossAnim.IsPlayingAnimationName("BossSignal") && bossBop) { diff --git a/Assets/Scripts/Games/Minigame.cs b/Assets/Scripts/Games/Minigame.cs index 24cc4c8bf..632bb8810 100644 --- a/Assets/Scripts/Games/Minigame.cs +++ b/Assets/Scripts/Games/Minigame.cs @@ -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) { Minigames.Minigame gameInfo = GameManager.instance.GetGameInfo(game); diff --git a/Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs b/Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs index 699ab5bd2..9de0976dc 100644 --- a/Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs +++ b/Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs @@ -349,24 +349,24 @@ namespace HeavenStudio.Games } } - private void LateUpdate() + public override void OnBeatPulse(double beat) { - if (Conductor.instance.ReportBeat(ref lastReportedBeat)) { - if ((MonkAnim.IsAnimationNotPlaying() || MonkAnim.IsPlayingAnimationName("Bop") || MonkAnim.IsPlayingAnimationName("Idle")) + if ((MonkAnim.IsAnimationNotPlaying() || MonkAnim.IsPlayingAnimationName("Bop") || MonkAnim.IsPlayingAnimationName("Idle")) && monkBop - && !isStaring) - { - MonkAnim.DoScaledAnimationAsync("Bop", 0.5f); - } + && !isStaring) + { + MonkAnim.DoScaledAnimationAsync("Bop", 0.5f); + } - if (!MonkAnim.IsPlayingAnimationName("Blush") || !MonkAnim.IsPlayingAnimationName("Stare")) { - if (growLevel == 4) BrowAnim.DoScaledAnimationAsync("Bop", 0.5f); - if (growLevel > 0) StacheAnim.DoScaledAnimationAsync($"Bop{growLevel}", 0.5f); - } + if (!MonkAnim.IsPlayingAnimationName("Blush") || !MonkAnim.IsPlayingAnimationName("Stare")) + { + if (growLevel == 4) BrowAnim.DoScaledAnimationAsync("Bop", 0.5f); + if (growLevel > 0) StacheAnim.DoScaledAnimationAsync($"Bop{growLevel}", 0.5f); + } - if (CloudMonkey.activeInHierarchy) { - CloudMonkey.GetComponent().DoScaledAnimationAsync("Bop", 0.5f); - } + if (CloudMonkey.activeInHierarchy) //Why activeInHierarchy? - Rasmus + { + CloudMonkey.GetComponent().DoScaledAnimationAsync("Bop", 0.5f); //DONT DO THIS!!! GetComponent is a really expensive operation - Rasmus } } diff --git a/Assets/Scripts/Games/OctopusMachine/Octopus.cs b/Assets/Scripts/Games/OctopusMachine/Octopus.cs index 532a4bfd5..b00e04977 100644 --- a/Assets/Scripts/Games/OctopusMachine/Octopus.cs +++ b/Assets/Scripts/Games/OctopusMachine/Octopus.cs @@ -17,7 +17,6 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine public bool isSqueezed; public bool isPreparing; public double queuePrepare; - public double lastReportedBeat = 0f; double lastSqueezeBeat; bool isActive = true; @@ -65,10 +64,9 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine } } - void LateUpdate() + public void RequestBop() { - if (Conductor.instance.ReportBeat(ref lastReportedBeat) - && !anim.IsPlayingAnimationName("Bop") + if (!anim.IsPlayingAnimationName("Bop") && !anim.IsPlayingAnimationName("Happy") && !anim.IsPlayingAnimationName("Angry") && !anim.IsPlayingAnimationName("Oops") diff --git a/Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs b/Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs index 2127d53d0..18fdf4eeb 100644 --- a/Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs +++ b/Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs @@ -206,7 +206,6 @@ namespace HeavenStudio.Games bool autoAction; double intervalStartBeat; float beatInterval = 1f; - double lastReportedBeat; static List queuedSqueezes = new(); static List queuedReleases = new(); @@ -253,6 +252,23 @@ namespace HeavenStudio.Games } } + public override void OnBeatPulse(double beat) + { + if (bopIterate >= 3) + { + bopStatus = + bopIterate = 0; + autoAction = false; + } + + if (autoAction) bopIterate++; + + foreach (var octo in octopodes) + { + octo.RequestBop(); + } + } + private void Update() { BackgroundColorUpdate(); @@ -261,17 +277,6 @@ namespace HeavenStudio.Games if (Text.text is "Wrong! Try Again!" or "Good!") Text.text = ""; queuePrepare = double.MaxValue; } - - if (Conductor.instance.ReportBeat(ref lastReportedBeat)) - { - if (bopIterate >= 3) { - bopStatus = - bopIterate = 0; - autoAction = false; - } - - if (autoAction) bopIterate++; - } } public void ChangeText(string text, string youText) diff --git a/Assets/Scripts/Games/RhythmRally/RhythmRally.cs b/Assets/Scripts/Games/RhythmRally/RhythmRally.cs index 28607ab70..0b808c355 100644 --- a/Assets/Scripts/Games/RhythmRally/RhythmRally.cs +++ b/Assets/Scripts/Games/RhythmRally/RhythmRally.cs @@ -152,7 +152,6 @@ namespace HeavenStudio.Games public Paddlers paddlers; - public GameEvent bop = new GameEvent(); private bool goBop = true; public static RhythmRally instance; @@ -357,16 +356,6 @@ namespace HeavenStudio.Games } } - - // Paddler bop animation. - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (goBop && !inPose) - { - BopSingle(); - } - } - opponentServing = false; //update camera @@ -375,6 +364,14 @@ namespace HeavenStudio.Games GameCamera.AdditionalFoV = cameraFOV; } + public override void OnBeatPulse(double beat) + { + if (goBop && !inPose) + { + BopSingle(); + } + } + public void Bop(double beat, float length, bool bop, bool bopAuto) { goBop = bopAuto; diff --git a/Assets/Scripts/Games/RhythmSomen/RhythmSomen.cs b/Assets/Scripts/Games/RhythmSomen/RhythmSomen.cs index 71b453230..ec54051b5 100644 --- a/Assets/Scripts/Games/RhythmSomen/RhythmSomen.cs +++ b/Assets/Scripts/Games/RhythmSomen/RhythmSomen.cs @@ -84,22 +84,20 @@ namespace HeavenStudio.Games instance = this; } - // Update is called once per frame + public override void OnBeatPulse(double beat) + { + if (shouldBop) SomenPlayer.DoScaledAnimationAsync("HeadBob", 0.5f); + } + void Update() { - var cond = Conductor.instance; - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop) - { - SomenPlayer.Play("HeadBob", -1, 0); - } - if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress)) { SoundByte.PlayOneShotGame("rhythmSomen/somen_mistake"); - FrontArm.Play("ArmPluck", -1, 0); - backArm.Play("BackArmNothing", 0, 0); + FrontArm.DoScaledAnimationAsync("ArmPluck", 0.5f); + backArm.DoScaledAnimationAsync("BackArmNothing", 0.5f); hasSlurped = false; - EffectSweat.Play("BlobSweating", -1, 0); + EffectSweat.DoScaledAnimationAsync("BlobSweating", 0.5f); ScoreMiss(); } } @@ -108,7 +106,7 @@ namespace HeavenStudio.Games { if (!missed) { - backArm.Play("BackArmLift", 0, 0); + backArm.DoScaledAnimationAsync("BackArmLift", 0.5f); FrontArm.DoScaledAnimationAsync("ArmSlurp", 0.5f); hasSlurped = true; BeatAction.New(instance, new List() @@ -117,8 +115,8 @@ namespace HeavenStudio.Games { if (hasSlurped) { - backArm.Play("BackArmNothing", 0, 0); - FrontArm.Play("ArmNothing", 0, 0); + backArm.DoScaledAnimationAsync("BackArmNothing", 0.5f); + FrontArm.DoScaledAnimationAsync("ArmNothing", 0.5f); } }) }); @@ -136,7 +134,7 @@ namespace HeavenStudio.Games { new BeatAction.Action(beat + i, delegate { - SomenPlayer.Play("HeadBob", -1, 0); + SomenPlayer.DoScaledAnimationAsync("HeadBob", 0.5f); }) }); } @@ -155,9 +153,9 @@ namespace HeavenStudio.Games BeatAction.New(instance, new List() { - new BeatAction.Action(beat, delegate { FarCrane.Play("Drop", -1, 0);}), - new BeatAction.Action(beat + 1.0f, delegate { FarCrane.Play("Open", -1, 0);}), - new BeatAction.Action(beat + 1.5f, delegate { FarCrane.Play("Lift", -1, 0);}), + new BeatAction.Action(beat, delegate { FarCrane.DoScaledAnimationAsync("Drop", 0.5f);}), + new BeatAction.Action(beat + 1.0f, delegate { FarCrane.DoScaledAnimationAsync("Open", 0.5f);}), + new BeatAction.Action(beat + 1.5f, delegate { FarCrane.DoScaledAnimationAsync("Lift", 0.5f);}), }); } @@ -174,9 +172,9 @@ namespace HeavenStudio.Games BeatAction.New(instance, new List() { - new BeatAction.Action(beat, delegate { CloseCrane.Play("DropClose", -1, 0);}), - new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.Play("OpenClose", -1, 0);}), - new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.Play("LiftClose", -1, 0);}), + new BeatAction.Action(beat, delegate { CloseCrane.DoScaledAnimationAsync("DropClose", 0.5f);}), + new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.DoScaledAnimationAsync("OpenClose", 0.5f);}), + new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.DoScaledAnimationAsync("LiftClose", 0.5f);}), }); } @@ -195,12 +193,12 @@ namespace HeavenStudio.Games BeatAction.New(instance, new List() { - new BeatAction.Action(beat, delegate { CloseCrane.Play("DropClose", -1, 0);}), - new BeatAction.Action(beat, delegate { FarCrane.Play("Drop", -1, 0);}), - new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.Play("OpenClose", -1, 0);}), - new BeatAction.Action(beat + 1.0f, delegate { FarCrane.Play("Open", -1, 0);}), - new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.Play("LiftClose", -1, 0);}), - new BeatAction.Action(beat + 1.5f, delegate { FarCrane.Play("Lift", -1, 0);}), + new BeatAction.Action(beat, delegate { CloseCrane.DoScaledAnimationAsync("DropClose", 0.5f);}), + new BeatAction.Action(beat, delegate { FarCrane.DoScaledAnimationAsync("Drop", 0.5f);}), + new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.DoScaledAnimationAsync("OpenClose", 0.5f);}), + new BeatAction.Action(beat + 1.0f, delegate { FarCrane.DoScaledAnimationAsync("Open", 0.5f);}), + new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.DoScaledAnimationAsync("LiftClose", 0.5f);}), + new BeatAction.Action(beat + 1.5f, delegate { FarCrane.DoScaledAnimationAsync("Lift", 0.5f);}), }); } @@ -212,35 +210,35 @@ namespace HeavenStudio.Games BeatAction.New(instance, new List() { - new BeatAction.Action(beat, delegate { EffectExclam.Play("ExclamAppear", -1, 0);}), + new BeatAction.Action(beat, delegate { EffectExclam.DoScaledAnimationAsync("ExclamAppear", 0.5f);}), }); } public void CatchSuccess(PlayerActionEvent caller, float state) { - backArm.Play("BackArmNothing", 0, 0); + backArm.DoScaledAnimationAsync("BackArmNothing", 0, 0); hasSlurped = false; splashEffect.Play(); if (state >= 1f || state <= -1f) { SoundByte.PlayOneShotGame("rhythmSomen/somen_splash"); - FrontArm.Play("ArmPluckNG", -1, 0); - EffectSweat.Play("BlobSweating", -1, 0); + FrontArm.DoScaledAnimationAsync("ArmPluckNG", 0.5f); + EffectSweat.DoScaledAnimationAsync("BlobSweating", 0.5f); missed = true; return; } SoundByte.PlayOneShotGame("rhythmSomen/somen_catch"); SoundByte.PlayOneShotGame("rhythmSomen/somen_catch_old", volume: 0.25f); - FrontArm.Play("ArmPluckOK", -1, 0); - EffectHit.Play("HitAppear", -1, 0); + FrontArm.DoScaledAnimationAsync("ArmPluckOK", 0.5f); + EffectHit.DoScaledAnimationAsync("HitAppear", 0.5f); missed = false; } public void CatchMiss(PlayerActionEvent caller) { missed = true; - EffectShock.Play("ShockAppear", -1, 0); + EffectShock.DoScaledAnimationAsync("ShockAppear", 0.5f); } public void CatchEmpty(PlayerActionEvent caller) diff --git a/Assets/Scripts/Games/Ringside/Ringside.cs b/Assets/Scripts/Games/Ringside/Ringside.cs index d70d7615e..5da8b759b 100644 --- a/Assets/Scripts/Games/Ringside/Ringside.cs +++ b/Assets/Scripts/Games/Ringside/Ringside.cs @@ -218,26 +218,27 @@ namespace HeavenStudio.Games ReporterBlink(); } + public override void OnBeatPulse(double beat) + { + if (shouldBop && canBop) + { + if (UnityEngine.Random.Range(1, 18) == 1) + { + wrestlerAnim.DoScaledAnimationAsync("BopPec"); + } + else + { + wrestlerAnim.DoScaledAnimationAsync("Bop"); + } + } + } + void Update() { var cond = Conductor.instance; if (cond.isPlaying && !cond.isPaused) { - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (shouldBop && canBop) - { - if (UnityEngine.Random.Range(1, 18) == 1) - { - wrestlerAnim.DoScaledAnimationAsync("BopPec"); - } - else - { - wrestlerAnim.DoScaledAnimationAsync("Bop"); - } - } - } if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress) && !shouldNotInput) { if ((PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch) diff --git a/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs b/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs index e50fe1559..13d41c7e2 100644 --- a/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs +++ b/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs @@ -169,16 +169,14 @@ namespace HeavenStudio.Games instance = this; } - // Update is called once per frame + public override void OnBeatPulse(double beat) + { + if (goBopSamurai) player.Bop(); + if (goBopChild) childParent.GetComponent().Bop(); + } + void Update() { - var cond = Conductor.instance; - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (goBopSamurai) player.Bop(); - if (goBopChild) childParent.GetComponent().Bop(); - } - if (PlayerInput.GetIsAction(InputAction_AltDown)) DoStep(); if (PlayerInput.GetIsAction(InputAction_AltUp) && player.isStepping()) diff --git a/Assets/Scripts/Games/SpaceDance/SpaceDance.cs b/Assets/Scripts/Games/SpaceDance/SpaceDance.cs index 978a4d3eb..45668df13 100644 --- a/Assets/Scripts/Games/SpaceDance/SpaceDance.cs +++ b/Assets/Scripts/Games/SpaceDance/SpaceDance.cs @@ -228,6 +228,18 @@ namespace HeavenStudio.Games colorEnd = defaultBGColor; } + public override void OnBeatPulse(double beat) + { + if (shouldBop) + { + Bop(); + } + if (spaceGrampsShouldBop) + { + GrampsBop(); + } + } + // Update is called once per frame void Update() { @@ -237,17 +249,6 @@ namespace HeavenStudio.Games { scroll.NormalizedX -= xBaseSpeed * xScrollMultiplier * Time.deltaTime; scroll.NormalizedY -= yBaseSpeed * yScrollMultiplier * Time.deltaTime; - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (shouldBop) - { - Bop(); - } - if (spaceGrampsShouldBop) - { - GrampsBop(); - } - } if (isShootingStar) { float normalizedBeat = cond.GetPositionFromBeat(shootingStarStartBeat, shootingStarLength); diff --git a/Assets/Scripts/Games/TapTrial/TapTrial.cs b/Assets/Scripts/Games/TapTrial/TapTrial.cs index dd69a99a6..0d43147b5 100644 --- a/Assets/Scripts/Games/TapTrial/TapTrial.cs +++ b/Assets/Scripts/Games/TapTrial/TapTrial.cs @@ -123,15 +123,16 @@ namespace HeavenStudio.Games instance = this; } + public override void OnBeatPulse(double beat) + { + if (shouldBop) SingleBop(); + } + private void Update() { var cond = Conductor.instance; if (cond.isPlaying && !cond.isPaused) { - if (shouldBop && cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - SingleBop(); - } GiraffeUpdate(cond); JumpUpdate(cond); ScrollUpdate(cond); diff --git a/Assets/Scripts/Games/TheDazzles/TheDazzles.cs b/Assets/Scripts/Games/TheDazzles/TheDazzles.cs index b1ef7e9a6..2a35b7e28 100644 --- a/Assets/Scripts/Games/TheDazzles/TheDazzles.cs +++ b/Assets/Scripts/Games/TheDazzles/TheDazzles.cs @@ -257,23 +257,24 @@ namespace HeavenStudio.Games instance = this; } + public override void OnBeatPulse(double beat) + { + if (shouldBop) + { + foreach (var girl in npcGirls) + { + girl.Bop(); + } + player.Bop(); + } + } + void Update() { var cond = Conductor.instance; if (cond.isPlaying && !cond.isPaused) { - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (shouldBop) - { - foreach (var girl in npcGirls) - { - girl.Bop(); - } - player.Bop(); - } - } if (queuedPoses.Count > 0) { foreach (var pose in queuedPoses) diff --git a/Assets/Scripts/Games/TossBoys/TossBoys.cs b/Assets/Scripts/Games/TossBoys/TossBoys.cs index 92ba26420..31c46cd3e 100644 --- a/Assets/Scripts/Games/TossBoys/TossBoys.cs +++ b/Assets/Scripts/Games/TossBoys/TossBoys.cs @@ -262,20 +262,20 @@ namespace HeavenStudio.Games return default(SuperCurveObject.Path); } + public override void OnBeatPulse(double beat) + { + if (shouldBop) + { + SingleBop(); + } + } + private void Update() { var cond = Conductor.instance; BackgroundColorUpdate(); if (cond.isPlaying && !cond.isPaused) { - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (shouldBop) - { - SingleBop(); - } - } - if (PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch) { TossKid next = GetCurrentReceiver(); diff --git a/Assets/Scripts/Games/TossBoys/TossKid.cs b/Assets/Scripts/Games/TossBoys/TossKid.cs index deba5d36c..d7d6a4f79 100644 --- a/Assets/Scripts/Games/TossBoys/TossKid.cs +++ b/Assets/Scripts/Games/TossBoys/TossKid.cs @@ -41,7 +41,7 @@ namespace HeavenStudio.Games.Scripts_TossBoys public void Bop() { - if (!anim.IsAnimationNotPlaying() || crouch || preparing) return; + if (crouch || preparing) return; DoAnimationScaledAsync("Bop", 0.5f); } diff --git a/Assets/Scripts/Games/TrickClass/TrickClass.cs b/Assets/Scripts/Games/TrickClass/TrickClass.cs index 4fb962988..31dda092e 100644 --- a/Assets/Scripts/Games/TrickClass/TrickClass.cs +++ b/Assets/Scripts/Games/TrickClass/TrickClass.cs @@ -116,18 +116,20 @@ namespace HeavenStudio.Games instance = this; } + public override void OnBeatPulse(double beat) + { + var cond = Conductor.instance; + if (!goBop) return; + if ((!playerReady) && cond.songPositionInBeatsAsDouble > playerBopStart) + playerAnim.DoScaledAnimationAsync("Bop"); + + if (cond.songPositionInBeatsAsDouble > girlBopStart) + girlAnim.DoScaledAnimationAsync("Bop"); + } + private void Update() { var cond = Conductor.instance; - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && goBop) - { - if ((!playerReady) && cond.songPositionInBeatsAsDouble > playerBopStart) - playerAnim.DoScaledAnimationAsync("Bop"); - - if (cond.songPositionInBeatsAsDouble > girlBopStart) - girlAnim.DoScaledAnimationAsync("Bop"); - } - if (cond.isPlaying && !cond.isPaused) { if (queuedInputs.Count > 0)