mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-13 11:37:40 +02:00
Collapsing Properties Update + Animation From Beat Method (#575)
* add entity to collapse function, start on new animation thingy im gonna use fork lifter to demonstrate DoScaledAnimationFromBeatAsync() cuz it uses animations to cue the peas also i fixed that months old bug where the fork lifter sfx wasn't playing correctly :/ * animation from beat functional, octo machine converted this looks fantastic i can't wait to implement this into more things * better anim function this is more efficient AND it'll produce more consistent results when starting an animation between tempo changes :D (it no longer iterates through a list twice)
This commit is contained in:
@ -15,7 +15,7 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine
|
||||
public bool cantBop;
|
||||
public bool isSqueezed;
|
||||
public bool isPreparing;
|
||||
public bool queuePrepare;
|
||||
public double queuePrepare;
|
||||
public double lastReportedBeat = 0f;
|
||||
double lastSqueezeBeat;
|
||||
bool isActive = true;
|
||||
@ -25,16 +25,17 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine
|
||||
void Awake()
|
||||
{
|
||||
game = OctopusMachine.instance;
|
||||
queuePrepare = double.MaxValue;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (queuePrepare && Conductor.instance.NotStopped()) {
|
||||
if (queuePrepare <= Conductor.instance.songPositionInBeatsAsDouble && Conductor.instance.NotStopped()) {
|
||||
if (!(isPreparing || isSqueezed || anim.IsPlayingAnimationName("Release") || anim.IsPlayingAnimationName("Pop")))
|
||||
{
|
||||
anim.DoScaledAnimationAsync("Prepare", 0.5f);
|
||||
anim.DoScaledAnimationFromBeatAsync("Prepare", 0.5f, queuePrepare);
|
||||
isPreparing = true;
|
||||
queuePrepare = false;
|
||||
queuePrepare = double.MaxValue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,15 +99,15 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine
|
||||
isActive = enable;
|
||||
}
|
||||
|
||||
public void OctoAction(string action)
|
||||
public void OctoAction(string action)
|
||||
{
|
||||
if (action != "Release" || (Conductor.instance.songPositionInBeatsAsDouble - lastSqueezeBeat) > 0.15f) SoundByte.PlayOneShotGame($"octopusMachine/{action.ToLower()}");
|
||||
if (action == "Squeeze") lastSqueezeBeat = Conductor.instance.songPositionInBeatsAsDouble;
|
||||
|
||||
anim.DoScaledAnimationAsync(action, 0.5f);
|
||||
isSqueezed = (action == "Squeeze");
|
||||
isPreparing =
|
||||
queuePrepare = false;
|
||||
isSqueezed = action == "Squeeze";
|
||||
isPreparing = false;
|
||||
queuePrepare = double.MaxValue;
|
||||
}
|
||||
|
||||
public void AnimationColor(int poppingColor)
|
||||
|
Reference in New Issue
Block a user