Animation speed helpers, stop on remix end (#91)

This commit is contained in:
minenice55
2022-06-06 12:54:49 -04:00
committed by GitHub
parent 52ecce8c3e
commit a4d6537f9c
5 changed files with 102 additions and 104 deletions

View File

@ -72,8 +72,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
Player.transform.localPosition = new Vector3(0, jumpHeight * yWeight);
Shadow.transform.localScale = new Vector3((1f-yWeight*0.2f) * 1.65f, (1f-yWeight*0.2f), 1f);
// handles the shirt lifting
anim.Play("MakoJump", -1, jumpPos);
anim.speed = 0;
anim.DoScaledAnimation("MakoJump", startJumpTime, jumpLength);
}
else
{
@ -84,12 +83,11 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
hasJumped = false;
PajamaParty.instance.DoBedImpact();
if (jumpNg)
anim.Play("MakoCatchNg", -1, 0);
anim.DoScaledAnimationAsync("MakoCatchNg");
else if (jumpHeight != 4f)
anim.Play("MakoCatch", -1, 0);
anim.DoScaledAnimationAsync("MakoCatch");
else
anim.Play("MakoLand", -1, 0);
anim.speed = 1f / cond.pitchedSecPerBeat;
anim.DoScaledAnimationAsync("MakoLand");
jumpNg = false;
}
startJumpTime = Single.MinValue;
@ -110,8 +108,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
}
else
{
Projectile.GetComponent<Animator>().Play("ThrowOut", -1, jumpPos);
Projectile.GetComponent<Animator>().speed = 0;
Projectile.GetComponent<Animator>().DoScaledAnimation("ThrowOut", startThrowTime, throwLength);
}
Projectile.transform.rotation = Quaternion.Euler(0, 0, Projectile.transform.rotation.eulerAngles.z - (360f * Time.deltaTime));
}
@ -125,16 +122,15 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
{
if (throwNg)
{
anim.Play("MakoCatchNg", -1, 0);
anim.DoUnscaledAnimation("MakoCatchNg");
}
else
{
anim.Play("MakoCatch", -1, 0);
anim.DoUnscaledAnimation("MakoCatch");
}
//TODO: change when locales are a thing
Jukebox.PlayOneShotGame("pajamaParty/jp/catch" + UnityEngine.Random.Range(0, 2)); //bruh
anim.speed = 1f;
Projectile.SetActive(false);
hasThrown = false;
throwNg = false;
@ -153,10 +149,9 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
if (drop)
{
throwType = false;
Projectile.GetComponent<Animator>().Play("ThrowOut", -1, 0);
Projectile.GetComponent<Animator>().speed = 0;
Projectile.transform.rotation = Quaternion.Euler(0, 0, 360f * UnityEngine.Random.Range(0f, 1f));
throwLength = 0.5f;
Projectile.GetComponent<Animator>().DoScaledAnimation("ThrowOut", startThrowTime, throwLength);
Projectile.transform.rotation = Quaternion.Euler(0, 0, 360f * UnityEngine.Random.Range(0f, 1f));
}
else
{
@ -181,8 +176,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
public void StartCharge()
{
canJump = false;
anim.Play("MakoReady");
anim.speed = 1f;
anim.DoUnscaledAnimation("MakoReady");
charging = true;
}
@ -193,22 +187,17 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
charging = false;
canCharge = false;
if (hit)
{
anim.Play("MakoThrow");
anim.speed = 1f;
}
anim.DoUnscaledAnimation("MakoThrow");
else
{
anim.Play("MakoThrowOut");
anim.speed = (1f / cond.pitchedSecPerBeat) * 0.5f;
anim.DoScaledAnimationAsync("MakoThrowOut", 0.5f);
BeatAction.New(Player, new List<BeatAction.Action>()
{
new BeatAction.Action(
beat + 0.5f,
delegate {
anim.Play("MakoPickUp", -1, 0);
anim.DoScaledAnimationAsync("MakoPickUp");
Jukebox.PlayOneShotGame("pajamaParty/jp/catch" + UnityEngine.Random.Range(0, 2)); //bruh
anim.speed = 1f / cond.pitchedSecPerBeat;
Projectile.SetActive(false);
canCharge = true;
canJump = true;
@ -221,8 +210,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
public void PlayerThrough(float beat)
{
var cond = Conductor.instance;
anim.Play("MakoThrough", -1, 0);
anim.speed = (1f / cond.pitchedSecPerBeat) * 0.5f;
anim.DoScaledAnimationAsync("MakoThrough", 0.5f);
charging = false;
canCharge = false;
canJump = false;
@ -352,8 +340,8 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
canCharge = true;
hasJumped = false;
PajamaParty.instance.DoBedImpact();
anim.Play("MakoLand", -1, 0);
anim.speed = 1f / cond.pitchedSecPerBeat;
anim.DoScaledAnimationAsync("MakoLand");
}
startJumpTime = Single.MinValue;
Player.transform.localPosition = new Vector3(0, 0);
@ -363,15 +351,11 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
{
new BeatAction.Action(
beat,
delegate { anim.Play("MakoSleep00", -1, 0);
anim.speed = 1f / cond.pitchedSecPerBeat;
}
delegate { anim.DoScaledAnimationAsync("MakoSleep00"); }
),
new BeatAction.Action(
beat + 0.5f,
delegate { anim.Play("MakoSleep01", -1, 0);
anim.speed = 1f;
}
delegate { anim.DoUnscaledAnimation("MakoSleep01"); }
),
new BeatAction.Action(
beat + 1f,
@ -383,10 +367,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
beat + 3f,
delegate {
if (canSleep)
{
anim.Play(alt ? "MakoReadySleep01" : "MakoReadySleep", -1, 0);
anim.speed = 1f / cond.pitchedSecPerBeat;
}
anim.DoScaledAnimationAsync(alt ? "MakoReadySleep01" : "MakoReadySleep");
}
),
new BeatAction.Action(
@ -407,23 +388,18 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
caller.CanHit(false);
canSleep = false;
if (state <= -1f || state >= 1f)
{
anim.Play("MakoSleepNg", -1, 0);
}
anim.DoUnscaledAnimation("MakoSleepNg");
else
{
Jukebox.PlayOneShotGame("pajamaParty/siesta4");
anim.Play("MakoSleepJust", -1, 0);
anim.speed = 1f / cond.pitchedSecPerBeat;
anim.DoScaledAnimationAsync("MakoSleepJust");
BeatAction.New(Player, new List<BeatAction.Action>()
{
new BeatAction.Action(
caller.startBeat + 7f,
delegate {
anim.Play("MakoAwake", -1, 0);
anim.speed = 1f / cond.pitchedSecPerBeat;
anim.DoScaledAnimationAsync("MakoAwake");
Jukebox.PlayOneShotGame("pajamaParty/siestaDone");
}
),
@ -437,8 +413,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
var cond = Conductor.instance;
if (canSleep)
{
anim.Play("MakoSleepThrough", -1, 0);
anim.speed = 1f / cond.pitchedSecPerBeat;
anim.DoScaledAnimationAsync("MakoSleepThrough", -1, 0);
caller.CanHit(false);
canSleep = false;
}
@ -449,9 +424,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
var cond = Conductor.instance;
if (canSleep)
{
anim.Play("MakoSleepOut", -1, 0);
anim.speed = (1f / cond.pitchedSecPerBeat) * 0.5f;
anim.DoScaledAnimationAsync("MakoSleepOut", 0.5f);
Jukebox.PlayOneShotGame("pajamaParty/siestaBad");
caller.CanHit(false);
canSleep = false;