minor fixes

This commit is contained in:
fu-majime 2024-04-03 17:02:07 +09:00
parent 80c7c5ab4e
commit deee024206
2 changed files with 48 additions and 12 deletions

View file

@ -13,6 +13,7 @@ namespace HeavenStudio.Games.Loaders
{ {
var botParams = new List<Param>() var botParams = new List<Param>()
{ {
new Param("practice", false, "Count-In"),
new Param("alt", false, "Alternate OK"), new Param("alt", false, "Alternate OK"),
new Param("type", Scripts_Fillbots.EndAnim.Both, "Success Reaction", "Set the reaction of the Robot."), new Param("type", Scripts_Fillbots.EndAnim.Both, "Success Reaction", "Set the reaction of the Robot."),
new Param("stop", false, "Stop Conveyer", "Toggle if the conveyer should be stopped when finished."), new Param("stop", false, "Stop Conveyer", "Toggle if the conveyer should be stopped when finished."),
@ -51,6 +52,7 @@ namespace HeavenStudio.Games.Loaders
preFunction = delegate { preFunction = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
Fillbots.PreSpawnFillbot(e.beat, 3, (int)Scripts_Fillbots.BotSize.Medium, e["colorFuel"], e["colorLampOff"], e["colorLampOn"], e["type"], e["alt"], e["stop"], e["color"]); Fillbots.PreSpawnFillbot(e.beat, 3, (int)Scripts_Fillbots.BotSize.Medium, e["colorFuel"], e["colorLampOff"], e["colorLampOn"], e["type"], e["alt"], e["stop"], e["color"]);
if (e["practice"]) Fillbots.FillErUp(e.beat + 3);
}, },
defaultLength = 8f, defaultLength = 8f,
parameters = botParams, parameters = botParams,
@ -60,6 +62,7 @@ namespace HeavenStudio.Games.Loaders
preFunction = delegate { preFunction = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
Fillbots.PreSpawnFillbot(e.beat, 7, (int)Scripts_Fillbots.BotSize.Large, e["colorFuel"], e["colorLampOff"], e["colorLampOn"], e["type"], e["alt"], e["stop"], e["color"]); Fillbots.PreSpawnFillbot(e.beat, 7, (int)Scripts_Fillbots.BotSize.Large, e["colorFuel"], e["colorLampOff"], e["colorLampOn"], e["type"], e["alt"], e["stop"], e["color"]);
if (e["practice"]) Fillbots.FillErUp(e.beat + 3);
}, },
defaultLength = 12f, defaultLength = 12f,
parameters = botParams, parameters = botParams,
@ -69,6 +72,7 @@ namespace HeavenStudio.Games.Loaders
preFunction = delegate { preFunction = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
Fillbots.PreSpawnFillbot(e.beat, 1, (int)Scripts_Fillbots.BotSize.Small, e["colorFuel"], e["colorLampOff"], e["colorLampOn"], e["type"], e["alt"], e["stop"], e["color"]); Fillbots.PreSpawnFillbot(e.beat, 1, (int)Scripts_Fillbots.BotSize.Small, e["colorFuel"], e["colorLampOff"], e["colorLampOn"], e["type"], e["alt"], e["stop"], e["color"]);
if (e["practice"]) Fillbots.FillErUp(e.beat + 3);
}, },
defaultLength = 6f, defaultLength = 6f,
parameters = botParams, parameters = botParams,
@ -78,6 +82,7 @@ namespace HeavenStudio.Games.Loaders
preFunction = delegate { preFunction = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
Fillbots.PreSpawnFillbot(e.beat, e.length-5, e["size"], e["colorFuel"], e["colorLampOff"], e["colorLampOn"], e["type"], e["alt"], e["stop"], e["color"]); Fillbots.PreSpawnFillbot(e.beat, e.length-5, e["size"], e["colorFuel"], e["colorLampOff"], e["colorLampOn"], e["type"], e["alt"], e["stop"], e["color"]);
if (e["practice"]) Fillbots.FillErUp(e.beat + 3);
}, },
defaultLength = 6f, defaultLength = 6f,
resizable = true, resizable = true,
@ -374,17 +379,17 @@ namespace HeavenStudio.Games
{ {
bot.StackToLeft(beat, 0.25); bot.StackToLeft(beat, 0.25);
} }
conveyerStartBeat = beat - 0.25; if (conveyerStartBeat is -2) conveyerStartBeat = beat - 0.25;
})); }));
actions.Add(new BeatAction.Action(beat, delegate actions.Add(new BeatAction.Action(beat, delegate
{ {
if (conveyerStartBeat != -1) conveyerNormalizedOffset = (conveyerNormalizedOffset + Conductor.instance.GetPositionFromBeat(conveyerStartBeat, 1)) % 1; RenewConveyerNormalizedOffset();
conveyerStartBeat = -2; conveyerStartBeat = -2;
})); }));
} else { } else {
actions.Add(new BeatAction.Action(beat - 0.5, delegate actions.Add(new BeatAction.Action(beat - 0.5, delegate
{ {
if (conveyerStartBeat != -1) conveyerNormalizedOffset = (conveyerNormalizedOffset + Conductor.instance.GetPositionFromBeat(conveyerStartBeat, 1)) % 1; RenewConveyerNormalizedOffset();
conveyerStartBeat = -2; conveyerStartBeat = -2;
})); }));
} }
@ -407,6 +412,15 @@ namespace HeavenStudio.Games
})); }));
BeatAction.New(instance, actions); BeatAction.New(instance, actions);
} }
public static void FillErUp(double beat)
{
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("fillbots/fillErUp1", beat - 0.5),
new MultiSound.Sound("fillbots/fillErUp2", beat - 0.25),
new MultiSound.Sound("fillbots/fillErUp3", beat),
}, forcePlay: true);
}
public void ToggleBop(double beat, float length, bool bopOrNah, bool autoBop) public void ToggleBop(double beat, float length, bool bopOrNah, bool autoBop)
{ {
@ -459,6 +473,14 @@ namespace HeavenStudio.Games
gear.localEulerAngles = new Vector3(0, 0, Mathf.LerpUnclamped(0, -90, beat)); gear.localEulerAngles = new Vector3(0, 0, Mathf.LerpUnclamped(0, -90, beat));
} }
} }
public void RenewConveyerNormalizedOffset()
{
if (conveyerStartBeat is not -1 or -2)
{
float normalizedBeat = Conductor.instance.GetPositionFromBeat(conveyerStartBeat, 1);
if (normalizedBeat >= 0) conveyerNormalizedOffset = (conveyerNormalizedOffset + normalizedBeat) % 4;
}
}
public void Blackout() public void Blackout()
{ {

View file

@ -90,7 +90,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots
private void OnDestroy() private void OnDestroy()
{ {
if (fillSound != null) fillSound.KillLoop(0); fillSoundRelease();
} }
private void Awake() private void Awake()
@ -127,7 +127,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots
if (normalized >= 8) if (normalized >= 8)
{ {
game.currentBots.Remove(this); game.currentBots.Remove(this);
Destroy(gameObject); Destroy(this.gameObject);
} }
} }
@ -175,7 +175,6 @@ namespace HeavenStudio.Games.Scripts_Fillbots
List<MultiSound.Sound> sounds = new(); List<MultiSound.Sound> sounds = new();
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 1); float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 1);
Debug.Log(Mathf.Max(normalizedBeat-0.1f, 0));
for (int i = (int)Mathf.Ceil(Mathf.Max(normalizedBeat-0.1f, 0)); i <= 2; i++) for (int i = (int)Mathf.Ceil(Mathf.Max(normalizedBeat-0.1f, 0)); i <= 2; i++)
{ {
sounds.Add(new("fillbots/" + sizePrefix + "Fall", startBeat + i)); sounds.Add(new("fillbots/" + sizePrefix + "Fall", startBeat + i));
@ -314,8 +313,9 @@ namespace HeavenStudio.Games.Scripts_Fillbots
new BeatAction.Action(startBeat + holdLength + 5.5, delegate { new BeatAction.Action(startBeat + holdLength + 5.5, delegate {
game.fillerHolding = false; game.fillerHolding = false;
SoundByte.PlayOneShotGame("fillbots/explosion"); SoundByte.PlayOneShotGame("fillbots/explosion");
fillSoundRelease();
game.currentBots.Remove(this); game.currentBots.Remove(this);
Destroy(gameObject); Destroy(this.gameObject);
}), }),
}); });
} }
@ -332,7 +332,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots
fullBody.DoScaledAnimationAsync("ReleaseLate", 0.5f); fullBody.DoScaledAnimationAsync("ReleaseLate", 0.5f);
SoundByte.PlayOneShotGame("fillbots/miss"); SoundByte.PlayOneShotGame("fillbots/miss");
} }
fillSound.KillLoop(0); fillSoundRelease();
beepEvent.enabled = false; beepEvent.enabled = false;
_botState = BotState.Ng; _botState = BotState.Ng;
game.fillerHolding = false; game.fillerHolding = false;
@ -367,7 +367,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots
fullBody.Play("HoldBarely", 0, 0); fullBody.Play("HoldBarely", 0, 0);
return; return;
} }
if (game.conveyerStartBeat != -1) game.conveyerNormalizedOffset = (game.conveyerNormalizedOffset + Conductor.instance.GetPositionFromBeat(game.conveyerStartBeat, 1)) % 1; game.RenewConveyerNormalizedOffset();
game.conveyerStartBeat = -1; game.conveyerStartBeat = -1;
conveyerLength = 1; conveyerLength = 1;
@ -376,7 +376,11 @@ namespace HeavenStudio.Games.Scripts_Fillbots
game.fillerHolding = true; game.fillerHolding = true;
fullBody.DoScaledAnimationAsync("Hold", 1f); fullBody.DoScaledAnimationAsync("Hold", 1f);
SoundByte.PlayOneShotGame("fillbots/beep"); SoundByte.PlayOneShotGame("fillbots/beep");
fillSound = SoundByte.PlayOneShotGame("fillbots/water", -1, 1 / (float)(holdLength / 3), 1, true);
float watarPitch = 3 / (float)(holdLength + 3) + 0.5f;
fillSound = SoundByte.PlayOneShotGame("fillbots/water", -1, watarPitch, 1, true);
fillSound.BendUp((float)holdLength * Conductor.instance.pitchedSecPerBeat / 0.5f,2*watarPitch); // sorry
releaseEvent = game.ScheduleInput(startBeat + 4, holdLength, Fillbots.InputAction_BasicRelease, JustRelease, Empty, Empty); releaseEvent = game.ScheduleInput(startBeat + 4, holdLength, Fillbots.InputAction_BasicRelease, JustRelease, Empty, Empty);
beepEvent = new GameEvent() beepEvent = new GameEvent()
{ {
@ -389,12 +393,13 @@ namespace HeavenStudio.Games.Scripts_Fillbots
private void JustRelease(PlayerActionEvent caller, float state) private void JustRelease(PlayerActionEvent caller, float state)
{ {
fillSound.KillLoop(0); fillSoundRelease();
beepEvent.enabled = false; beepEvent.enabled = false;
if (conveyerRestartLength >= 0) if (conveyerRestartLength >= 0)
{ {
this.conveyerStartBeat = caller.timer + caller.startBeat + conveyerRestartLength; this.conveyerStartBeat = caller.timer + caller.startBeat + conveyerRestartLength;
if (game.conveyerStartBeat != -2) game.conveyerStartBeat = this.conveyerStartBeat; game.RenewConveyerNormalizedOffset();
if (game.conveyerStartBeat is not -2) game.conveyerStartBeat = this.conveyerStartBeat;
} }
else else
{ {
@ -483,6 +488,15 @@ namespace HeavenStudio.Games.Scripts_Fillbots
private void Empty(PlayerActionEvent caller) { } private void Empty(PlayerActionEvent caller) { }
private void fillSoundRelease()
{
if (fillSound != null)
{
fillSound.KillLoop(0);
fillSound = null;
}
}
public void SuccessDance() public void SuccessDance()
{ {
fullBody.DoScaledAnimationAsync("Success", 0.5f); fullBody.DoScaledAnimationAsync("Success", 0.5f);