diff --git a/Assets/Scripts/Games/WorkingDough/PlayerEnterDoughBall.cs b/Assets/Scripts/Games/WorkingDough/PlayerEnterDoughBall.cs index dd1f6c29..e4e172ef 100644 --- a/Assets/Scripts/Games/WorkingDough/PlayerEnterDoughBall.cs +++ b/Assets/Scripts/Games/WorkingDough/PlayerEnterDoughBall.cs @@ -20,7 +20,7 @@ namespace HeavenStudio.Games.Scripts_WorkingDough } private State currentState; - private double startBeat; + private double startBeat = double.MinValue; private bool big; @@ -64,45 +64,49 @@ namespace HeavenStudio.Games.Scripts_WorkingDough if (cond.isPlaying && !cond.isPaused) { - Vector3 pos = new Vector3(); - double beat = cond.songPositionInBeats; - switch (currentState) + if (startBeat > double.MinValue) { - case State.None: - break; - case State.Entering: - pos = GetPathPositionFromBeat(enterPath, Math.Max(beat, startBeat), startBeat); - break; - case State.Hit: - pos = GetPathPositionFromBeat(hitPath, Math.Max(beat, startBeat), startBeat); - if (beat >= startBeat + 1) - { - Destroy(gameObject); - } - break; - case State.Miss: - pos = GetPathPositionFromBeat(missPath, Math.Max(beat, startBeat), startBeat); - if (beat >= startBeat + 1) - { - Destroy(gameObject); - } - break; - case State.Weak: - pos = GetPathPositionFromBeat(weakPath, Math.Max(beat, startBeat), startBeat); - if (beat >= startBeat + 1) - { - Destroy(gameObject); - } - break; - case State.Barely: - pos = GetPathPositionFromBeat(barelyPath, Math.Max(beat, startBeat), startBeat); - if (beat >= startBeat + 2) - { - Destroy(gameObject); - } - break; + Vector3 pos = new Vector3(); + double beat = cond.songPositionInBeats; + switch (currentState) + { + case State.None: + break; + case State.Entering: + pos = GetPathPositionFromBeat(enterPath, Math.Max(beat, startBeat), startBeat); + break; + case State.Hit: + pos = GetPathPositionFromBeat(hitPath, Math.Max(beat, startBeat), startBeat); + if (beat >= startBeat + 1) + { + Destroy(gameObject); + } + break; + case State.Miss: + pos = GetPathPositionFromBeat(missPath, Math.Max(beat, startBeat), startBeat); + if (beat >= startBeat + 1) + { + Destroy(gameObject); + } + break; + case State.Weak: + pos = GetPathPositionFromBeat(weakPath, Math.Max(beat, startBeat), startBeat); + if (beat >= startBeat + 1) + { + Destroy(gameObject); + } + break; + case State.Barely: + pos = GetPathPositionFromBeat(barelyPath, Math.Max(beat, startBeat), startBeat); + if (beat >= startBeat + 2) + { + Destroy(gameObject); + } + break; + } + if (startBeat <= beat) transform.position = pos; + else transform.position = new Vector3(-80, -80); } - transform.position = pos; } } @@ -123,12 +127,12 @@ namespace HeavenStudio.Games.Scripts_WorkingDough if (big) { SoundByte.PlayOneShotGame("workingDough/bigPlayer"); - game.doughDudesPlayer.GetComponent().Play("BigDoughJump", 0, 0); + game.doughDudesPlayer.GetComponent().DoScaledAnimationAsync("BigDoughJump", 0.5f); } else { SoundByte.PlayOneShotGame("workingDough/smallPlayer"); - game.doughDudesPlayer.GetComponent().Play("SmallDoughJump", 0, 0); + game.doughDudesPlayer.GetComponent().DoScaledAnimationAsync("SmallDoughJump", 0.5f); } Update(); return; @@ -138,14 +142,14 @@ namespace HeavenStudio.Games.Scripts_WorkingDough { SoundByte.PlayOneShotGame("workingDough/bigPlayer"); SoundByte.PlayOneShotGame("workingDough/hitBigPlayer"); - game.doughDudesPlayer.GetComponent().Play("BigDoughJump", 0, 0); + game.doughDudesPlayer.GetComponent().DoScaledAnimationAsync("BigDoughJump", 0.5f); game.backgroundAnimator.Play("BackgroundFlash", 0, 0); } else { SoundByte.PlayOneShotGame("workingDough/smallPlayer"); SoundByte.PlayOneShotGame("workingDough/hitSmallPlayer"); - game.doughDudesPlayer.GetComponent().Play("SmallDoughJump", 0, 0); + game.doughDudesPlayer.GetComponent().DoScaledAnimationAsync("SmallDoughJump", 0.5f); } bool hasGandw = false; if (gandw != null) hasGandw = gandw.activeSelf; @@ -171,7 +175,7 @@ namespace HeavenStudio.Games.Scripts_WorkingDough { currentState = State.Weak; startBeat = beat; - game.doughDudesPlayer.GetComponent().Play("SmallDoughJump", 0, 0); + game.doughDudesPlayer.GetComponent().DoScaledAnimationAsync("SmallDoughJump", 0.5f); SoundByte.PlayOneShotGame("workingDough/smallPlayer"); SoundByte.PlayOneShotGame("workingDough/tooBig"); Update(); @@ -179,7 +183,7 @@ namespace HeavenStudio.Games.Scripts_WorkingDough else { GameObject.Instantiate(game.breakParticleEffect, game.breakParticleHolder); - game.doughDudesPlayer.GetComponent().Play("BigDoughJump", 0, 0); + game.doughDudesPlayer.GetComponent().DoScaledAnimationAsync("BigDoughJump", 0.5f); SoundByte.PlayOneShotGame("workingDough/bigPlayer"); SoundByte.PlayOneShotGame("workingDough/tooSmall"); Destroy(gameObject); diff --git a/Assets/Scripts/Games/WorkingDough/WorkingDough.cs b/Assets/Scripts/Games/WorkingDough/WorkingDough.cs index 05a2b76e..d42ff311 100644 --- a/Assets/Scripts/Games/WorkingDough/WorkingDough.cs +++ b/Assets/Scripts/Games/WorkingDough/WorkingDough.cs @@ -365,7 +365,7 @@ namespace HeavenStudio.Games { //Jump and play sound new BeatAction.Action(beat + 0.1f, delegate { arrowSRLeftNPC.sprite = whiteArrowSprite; }), - new BeatAction.Action(beat + 1f, delegate { doughDudesNPC.GetComponent().Play(isBig ? "BigDoughJump" :"SmallDoughJump", 0, 0); }), + new BeatAction.Action(beat + 1f, delegate { doughDudesNPC.GetComponent().DoScaledAnimationAsync(isBig ? "BigDoughJump" :"SmallDoughJump", 0.5f); }), new BeatAction.Action(beat + 1f, delegate { npcImpact.SetActive(true); }), new BeatAction.Action(beat + 1.1f, delegate { npcImpact.SetActive(false); }), new BeatAction.Action(beat + 1.9f, delegate { arrowSRRightNPC.sprite = redArrowSprite; }), @@ -532,12 +532,12 @@ namespace HeavenStudio.Games } if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN)) { - doughDudesPlayer.GetComponent().Play("SmallDoughJump", 0, 0); + doughDudesPlayer.GetComponent().DoScaledAnimationAsync("SmallDoughJump", 0.5f); SoundByte.PlayOneShotGame("workingDough/smallPlayer"); } else if (PlayerInput.AltPressed() && !IsExpectingInputNow(InputType.STANDARD_ALT_DOWN)) { - doughDudesPlayer.GetComponent().Play("BigDoughJump", 0, 0); + doughDudesPlayer.GetComponent().DoScaledAnimationAsync("BigDoughJump", 0.5f); SoundByte.PlayOneShotGame("workingDough/bigPlayer"); } }