Fixed stuff also scaled now yippee

This commit is contained in:
Rapandrasmus 2023-06-15 20:13:11 +02:00
parent 16ce508b03
commit c6fb8880a0
2 changed files with 51 additions and 47 deletions

View File

@ -20,7 +20,7 @@ namespace HeavenStudio.Games.Scripts_WorkingDough
} }
private State currentState; private State currentState;
private double startBeat; private double startBeat = double.MinValue;
private bool big; private bool big;
@ -64,45 +64,49 @@ namespace HeavenStudio.Games.Scripts_WorkingDough
if (cond.isPlaying && !cond.isPaused) if (cond.isPlaying && !cond.isPaused)
{ {
Vector3 pos = new Vector3(); if (startBeat > double.MinValue)
double beat = cond.songPositionInBeats;
switch (currentState)
{ {
case State.None: Vector3 pos = new Vector3();
break; double beat = cond.songPositionInBeats;
case State.Entering: switch (currentState)
pos = GetPathPositionFromBeat(enterPath, Math.Max(beat, startBeat), startBeat); {
break; case State.None:
case State.Hit: break;
pos = GetPathPositionFromBeat(hitPath, Math.Max(beat, startBeat), startBeat); case State.Entering:
if (beat >= startBeat + 1) pos = GetPathPositionFromBeat(enterPath, Math.Max(beat, startBeat), startBeat);
{ break;
Destroy(gameObject); case State.Hit:
} pos = GetPathPositionFromBeat(hitPath, Math.Max(beat, startBeat), startBeat);
break; if (beat >= startBeat + 1)
case State.Miss: {
pos = GetPathPositionFromBeat(missPath, Math.Max(beat, startBeat), startBeat); Destroy(gameObject);
if (beat >= startBeat + 1) }
{ break;
Destroy(gameObject); case State.Miss:
} pos = GetPathPositionFromBeat(missPath, Math.Max(beat, startBeat), startBeat);
break; if (beat >= startBeat + 1)
case State.Weak: {
pos = GetPathPositionFromBeat(weakPath, Math.Max(beat, startBeat), startBeat); Destroy(gameObject);
if (beat >= startBeat + 1) }
{ break;
Destroy(gameObject); case State.Weak:
} pos = GetPathPositionFromBeat(weakPath, Math.Max(beat, startBeat), startBeat);
break; if (beat >= startBeat + 1)
case State.Barely: {
pos = GetPathPositionFromBeat(barelyPath, Math.Max(beat, startBeat), startBeat); Destroy(gameObject);
if (beat >= startBeat + 2) }
{ break;
Destroy(gameObject); case State.Barely:
} pos = GetPathPositionFromBeat(barelyPath, Math.Max(beat, startBeat), startBeat);
break; 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) if (big)
{ {
SoundByte.PlayOneShotGame("workingDough/bigPlayer"); SoundByte.PlayOneShotGame("workingDough/bigPlayer");
game.doughDudesPlayer.GetComponent<Animator>().Play("BigDoughJump", 0, 0); game.doughDudesPlayer.GetComponent<Animator>().DoScaledAnimationAsync("BigDoughJump", 0.5f);
} }
else else
{ {
SoundByte.PlayOneShotGame("workingDough/smallPlayer"); SoundByte.PlayOneShotGame("workingDough/smallPlayer");
game.doughDudesPlayer.GetComponent<Animator>().Play("SmallDoughJump", 0, 0); game.doughDudesPlayer.GetComponent<Animator>().DoScaledAnimationAsync("SmallDoughJump", 0.5f);
} }
Update(); Update();
return; return;
@ -138,14 +142,14 @@ namespace HeavenStudio.Games.Scripts_WorkingDough
{ {
SoundByte.PlayOneShotGame("workingDough/bigPlayer"); SoundByte.PlayOneShotGame("workingDough/bigPlayer");
SoundByte.PlayOneShotGame("workingDough/hitBigPlayer"); SoundByte.PlayOneShotGame("workingDough/hitBigPlayer");
game.doughDudesPlayer.GetComponent<Animator>().Play("BigDoughJump", 0, 0); game.doughDudesPlayer.GetComponent<Animator>().DoScaledAnimationAsync("BigDoughJump", 0.5f);
game.backgroundAnimator.Play("BackgroundFlash", 0, 0); game.backgroundAnimator.Play("BackgroundFlash", 0, 0);
} }
else else
{ {
SoundByte.PlayOneShotGame("workingDough/smallPlayer"); SoundByte.PlayOneShotGame("workingDough/smallPlayer");
SoundByte.PlayOneShotGame("workingDough/hitSmallPlayer"); SoundByte.PlayOneShotGame("workingDough/hitSmallPlayer");
game.doughDudesPlayer.GetComponent<Animator>().Play("SmallDoughJump", 0, 0); game.doughDudesPlayer.GetComponent<Animator>().DoScaledAnimationAsync("SmallDoughJump", 0.5f);
} }
bool hasGandw = false; bool hasGandw = false;
if (gandw != null) hasGandw = gandw.activeSelf; if (gandw != null) hasGandw = gandw.activeSelf;
@ -171,7 +175,7 @@ namespace HeavenStudio.Games.Scripts_WorkingDough
{ {
currentState = State.Weak; currentState = State.Weak;
startBeat = beat; startBeat = beat;
game.doughDudesPlayer.GetComponent<Animator>().Play("SmallDoughJump", 0, 0); game.doughDudesPlayer.GetComponent<Animator>().DoScaledAnimationAsync("SmallDoughJump", 0.5f);
SoundByte.PlayOneShotGame("workingDough/smallPlayer"); SoundByte.PlayOneShotGame("workingDough/smallPlayer");
SoundByte.PlayOneShotGame("workingDough/tooBig"); SoundByte.PlayOneShotGame("workingDough/tooBig");
Update(); Update();
@ -179,7 +183,7 @@ namespace HeavenStudio.Games.Scripts_WorkingDough
else else
{ {
GameObject.Instantiate(game.breakParticleEffect, game.breakParticleHolder); GameObject.Instantiate(game.breakParticleEffect, game.breakParticleHolder);
game.doughDudesPlayer.GetComponent<Animator>().Play("BigDoughJump", 0, 0); game.doughDudesPlayer.GetComponent<Animator>().DoScaledAnimationAsync("BigDoughJump", 0.5f);
SoundByte.PlayOneShotGame("workingDough/bigPlayer"); SoundByte.PlayOneShotGame("workingDough/bigPlayer");
SoundByte.PlayOneShotGame("workingDough/tooSmall"); SoundByte.PlayOneShotGame("workingDough/tooSmall");
Destroy(gameObject); Destroy(gameObject);

View File

@ -365,7 +365,7 @@ namespace HeavenStudio.Games
{ {
//Jump and play sound //Jump and play sound
new BeatAction.Action(beat + 0.1f, delegate { arrowSRLeftNPC.sprite = whiteArrowSprite; }), new BeatAction.Action(beat + 0.1f, delegate { arrowSRLeftNPC.sprite = whiteArrowSprite; }),
new BeatAction.Action(beat + 1f, delegate { doughDudesNPC.GetComponent<Animator>().Play(isBig ? "BigDoughJump" :"SmallDoughJump", 0, 0); }), new BeatAction.Action(beat + 1f, delegate { doughDudesNPC.GetComponent<Animator>().DoScaledAnimationAsync(isBig ? "BigDoughJump" :"SmallDoughJump", 0.5f); }),
new BeatAction.Action(beat + 1f, delegate { npcImpact.SetActive(true); }), new BeatAction.Action(beat + 1f, delegate { npcImpact.SetActive(true); }),
new BeatAction.Action(beat + 1.1f, delegate { npcImpact.SetActive(false); }), new BeatAction.Action(beat + 1.1f, delegate { npcImpact.SetActive(false); }),
new BeatAction.Action(beat + 1.9f, delegate { arrowSRRightNPC.sprite = redArrowSprite; }), new BeatAction.Action(beat + 1.9f, delegate { arrowSRRightNPC.sprite = redArrowSprite; }),
@ -532,12 +532,12 @@ namespace HeavenStudio.Games
} }
if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN)) if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN))
{ {
doughDudesPlayer.GetComponent<Animator>().Play("SmallDoughJump", 0, 0); doughDudesPlayer.GetComponent<Animator>().DoScaledAnimationAsync("SmallDoughJump", 0.5f);
SoundByte.PlayOneShotGame("workingDough/smallPlayer"); SoundByte.PlayOneShotGame("workingDough/smallPlayer");
} }
else if (PlayerInput.AltPressed() && !IsExpectingInputNow(InputType.STANDARD_ALT_DOWN)) else if (PlayerInput.AltPressed() && !IsExpectingInputNow(InputType.STANDARD_ALT_DOWN))
{ {
doughDudesPlayer.GetComponent<Animator>().Play("BigDoughJump", 0, 0); doughDudesPlayer.GetComponent<Animator>().DoScaledAnimationAsync("BigDoughJump", 0.5f);
SoundByte.PlayOneShotGame("workingDough/bigPlayer"); SoundByte.PlayOneShotGame("workingDough/bigPlayer");
} }
} }