From cc1a5bdcf98e9686d656ef83e51e94809ad6139c Mon Sep 17 00:00:00 2001 From: fu-majime Date: Mon, 25 Mar 2024 09:49:21 +0900 Subject: [PATCH] Shoot Rod (mute) --- .../Games/BuiltToScaleRvl/BuiltToScaleRvl.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/Games/BuiltToScaleRvl/BuiltToScaleRvl.cs b/Assets/Scripts/Games/BuiltToScaleRvl/BuiltToScaleRvl.cs index 3d223368b..1c3a02dac 100644 --- a/Assets/Scripts/Games/BuiltToScaleRvl/BuiltToScaleRvl.cs +++ b/Assets/Scripts/Games/BuiltToScaleRvl/BuiltToScaleRvl.cs @@ -35,6 +35,7 @@ namespace HeavenStudio.Games.Loaders parameters = new List() { new Param("id", new EntityTypes.Integer(1, 4, 0), "Rod ID", "Set the ID of the rod to shoot."), + new Param("mute", false, "Mute", "Toggle if the cue should be muted."), }, }, new GameAction("out sides", "Bounce Out Sides") @@ -170,6 +171,7 @@ namespace HeavenStudio.Games public CustomBounceItem[] bounceItems; public int endTime; public bool isShoot; + public bool mute; } public class CustomBounceItem @@ -220,8 +222,8 @@ namespace HeavenStudio.Games List bounceItems = CalcRodBounce(evt.beat, evt.length, evt["id"]); AddBounceOutSides(evt.beat, evt.length, currentPos, nextPos, evt["id"], ref bounceItems); - bool isShoot; - int rodEndTime = CalcRodEndTime(evt.beat, evt.length, currentPos, nextPos, evt["id"], ref bounceItems, out isShoot); + bool isShoot, mute; + int rodEndTime = CalcRodEndTime(evt.beat, evt.length, currentPos, nextPos, evt["id"], ref bounceItems, out isShoot, out mute); var widget = new ScheduledWidget { beat = evt.beat, @@ -232,6 +234,7 @@ namespace HeavenStudio.Games bounceItems = bounceItems.ToArray(), endTime = rodEndTime, isShoot = isShoot, + mute = mute, }; scheduledWidgets.Add(widget); } @@ -269,7 +272,7 @@ namespace HeavenStudio.Games var widget = scheduledWidgets[widgetIndex]; if (widget.beat < beat + WIDGET_SEEK_TIME) { - SpawnRod(widget.beat, widget.length, widget.currentPos, widget.nextPos, widget.id, widget.bounceItems, widget.endTime, widget.isShoot); + SpawnRod(widget.beat, widget.length, widget.currentPos, widget.nextPos, widget.id, widget.bounceItems, widget.endTime, widget.isShoot, widget.mute); widgetIndex++; } else @@ -279,7 +282,7 @@ namespace HeavenStudio.Games } } - public void SpawnRod(double beat, double length, int currentPos, int nextPos, int id, CustomBounceItem[] bounceItems, int endTime, bool isShoot) + public void SpawnRod(double beat, double length, int currentPos, int nextPos, int id, CustomBounceItem[] bounceItems, int endTime, bool isShoot, bool mute = false) { var newRod = Instantiate(baseRod, widgetHolder).GetComponent(); @@ -294,7 +297,7 @@ namespace HeavenStudio.Games if (isShoot) { double endBeat = beat + length * endTime; - SoundByte.PlayOneShotGame("builtToScaleRvl/prepare", endBeat - 2*length); + if (!mute) SoundByte.PlayOneShotGame("builtToScaleRvl/prepare", endBeat - 2*length); newRod.Squares = SpawnSquare(endBeat, id); } BeatAction.New(instance, new List() @@ -382,15 +385,17 @@ namespace HeavenStudio.Games } } - private int CalcRodEndTime(double beat, double length, int currentPos, int nextPos, int id, ref List bounceItems, out bool isShoot) + private int CalcRodEndTime(double beat, double length, int currentPos, int nextPos, int id, ref List bounceItems, out bool isShoot, out bool mute) { isShoot = false; + mute = false; int earliestEndTime = int.MaxValue; var firstShoot = EventCaller.GetAllInGameManagerList("builtToScaleRvl", new string[] { "shoot rod" }).Find(x => x.beat >= beat + length && x["id"] == id); if (firstShoot is not null) { earliestEndTime = (int)Math.Ceiling((firstShoot.beat - beat)/length); isShoot = true; + mute = firstShoot["mute"]; } bounceItems = bounceItems.FindAll(x => x.time < earliestEndTime);