From 5a336c3605aebb2e65f4477f16874aa275443807 Mon Sep 17 00:00:00 2001 From: blank3times <105398129+blank3times@users.noreply.github.com> Date: Fri, 26 Jan 2024 22:55:50 -0800 Subject: [PATCH] Begin bopping monkey will do one bop --- Assets/Scripts/Games/HoleInOne/HoleInOne.cs | 35 +++++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/Games/HoleInOne/HoleInOne.cs b/Assets/Scripts/Games/HoleInOne/HoleInOne.cs index 8d3ffba8d..02acbba90 100644 --- a/Assets/Scripts/Games/HoleInOne/HoleInOne.cs +++ b/Assets/Scripts/Games/HoleInOne/HoleInOne.cs @@ -18,9 +18,15 @@ namespace HeavenStudio.Games.Loaders { return new Minigame("holeInOne", "Hole in One", "6ab99e", false, false, new List() { - new GameAction("testanims", "Test Animation") // Delete this one when the game is more competent + new GameAction("bop", "Bop") { - function = delegate { HoleInOne.instance.DoTestAnim(eventCaller.currentEntity.beat); }, + function = delegate { var e = eventCaller.currentEntity; HoleInOne.instance.ToggleBop(e.beat, e.length, e["bop"], e["autobop"]); }, + resizable = true, + parameters = new List() + { + new Param("bop", true, "Bop", "Toggle if the characters should bop for the duration of this event."), + new Param("autobop", false, "Bop (Auto)", "Toggle if the characters should automatically bop until another Bop event is reached.") + } }, new GameAction("mandrill", "Mandrill (no visuals)") { @@ -54,13 +60,30 @@ namespace HeavenStudio.Games void Awake() { HoleInOne.instance = this; + SetupBopRegion("holeInOne", "bop", "autoBop"); } - // Delete this one when the game is more competent - public void DoTestAnim(double beat) + public override void OnBeatPulse(double beat) { - SoundByte.PlayOneShotGame("holeInOne/whale"); - MonkeyAnim.Play("MonkeySpin"); + if (BeatIsInBopRegion(beat)) MonkeyAnim.Play("MonkeyBop"); + } + + public void ToggleBop(double beat, float length, bool shouldBop, bool autoBop) + { + if (shouldBop) + { + for (int i = 0; i < length; i++) + { + BeatAction.New(instance, new List() + { + new BeatAction.Action(beat + i, delegate + { + MonkeyAnim.Play("MonkeyBop"); + // TODO add bops for other characters + }) + }); + } + } } public void DoMandrill(double beat)