From a61b10ca3a6bd5633eb1d6cc6457e791802d867d Mon Sep 17 00:00:00 2001 From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Date: Thu, 22 Jun 2023 21:34:03 +0200 Subject: [PATCH] Umbrella drum pattern added --- .../Games/NightWalkAgb/AgbNightWalk.cs | 67 ++++++++++++++++++- .../Scripts/Games/NightWalkAgb/AgbPlatform.cs | 11 ++- 2 files changed, 73 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs b/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs index 76b1590ff..80bbd733e 100644 --- a/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs +++ b/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs @@ -35,9 +35,18 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("type", "Platform Type") { + preFunction = delegate + { + var e = eventCaller.currentEntity; + if (e["type"] == (int)AgbNightWalk.PlatformType.Umbrella) + { + AgbNightWalk.FillSound(e.beat, (AgbNightWalk.FillType)e["fill"]); + } + }, parameters = new List() { - new Param("type", AgbNightWalk.PlatformType.Lollipop, "Type") + new Param("type", AgbNightWalk.PlatformType.Lollipop, "Type"), + new Param("fill", AgbNightWalk.FillType.None, "Umbrella Drum Pattern") } }, new GameAction("noJump", "No Jumping") @@ -61,6 +70,15 @@ namespace HeavenStudio.Games Lollipop = 2, Umbrella = 3 } + + public enum FillType + { + None, + Pattern1, + Pattern2, + Pattern3, + } + public static AgbNightWalk instance; public AgbPlayYan playYan; [SerializeField] private AgbPlatformHandler platformHandler; @@ -73,7 +91,12 @@ namespace HeavenStudio.Games public int value; } List heightEntityEvents = new(); - [NonSerialized] public Dictionary platformTypes = new(); + [NonSerialized] public Dictionary platformTypes = new(); + public struct TypeEvent + { + public PlatformType platformType; + public FillType fillType; + } new void OnDrawGizmos() { @@ -117,7 +140,12 @@ namespace HeavenStudio.Games if (!platformTypes.ContainsKey(typeEvent.beat)) { PlatformType type = (PlatformType)typeEvent["type"]; - platformTypes.Add(typeEvent.beat, type); + FillType fill = (FillType)typeEvent["fill"]; + platformTypes.Add(typeEvent.beat, new TypeEvent + { + fillType = fill, + platformType = type + }); } } @@ -152,6 +180,39 @@ namespace HeavenStudio.Games platformHandler.SpawnPlatforms(beat); } + public static void FillSound(double beat, FillType fill) + { + switch (fill) + { + case FillType.None: + break; + case FillType.Pattern1: + MultiSound.Play(new MultiSound.Sound[] + { + new MultiSound.Sound("nightWalkAgb/fill1A", beat - ((1/3) * 2)), + new MultiSound.Sound("nightWalkAgb/fill1B", beat - 0.5), + new MultiSound.Sound("nightWalkAgb/fill1C", beat - (1/3)), + new MultiSound.Sound("nightWalkAgb/fill1D", beat - ((1/3) * 0.5)), + }, forcePlay: true); + break; + case FillType.Pattern2: + MultiSound.Play(new MultiSound.Sound[] + { + new MultiSound.Sound("nightWalkAgb/fill2A", beat - ((1/3) * 2)), + new MultiSound.Sound("nightWalkAgb/fill2B", beat - 0.5), + new MultiSound.Sound("nightWalkAgb/fill2C", beat - ((1/3) * 0.5)), + }, forcePlay: true); + break; + case FillType.Pattern3: + MultiSound.Play(new MultiSound.Sound[] + { + new MultiSound.Sound("nightWalkAgb/fill3A", beat - ((1/3) * 2)), + new MultiSound.Sound("nightWalkAgb/fill3B", beat - 0.5), + }, forcePlay: true); + break; + } + } + private void SetCountInBeat(double beat) { List countInEvents = EventCaller.GetAllInGameManagerList("nightWalkAgb", new string[] { "countIn" }); diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs b/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs index bdede60b7..e21c219ba 100644 --- a/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs +++ b/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs @@ -29,6 +29,7 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk [SerializeField] private GameObject platform; private bool canKick; + private bool doFillStartSound = false; public void StartInput(double beat, double hitBeat) { @@ -41,7 +42,7 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk endBeat = hitBeat; if (game.platformTypes.ContainsKey(hitBeat)) { - if (game.platformTypes[hitBeat] == AgbNightWalk.PlatformType.Lollipop) + if (game.platformTypes[hitBeat].platformType == AgbNightWalk.PlatformType.Lollipop) { type = PlatformType.Lollipop; } @@ -49,10 +50,15 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk { type = PlatformType.Umbrella; } + doFillStartSound = false; } else { type = PlatformType.Flower; + if (game.platformTypes.ContainsKey(hitBeat + 1)) + { + doFillStartSound = game.platformTypes[hitBeat + 1].fillType != AgbNightWalk.FillType.None; + } } if (startBeat < endBeat) { @@ -131,7 +137,8 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk { return; } - SoundByte.PlayOneShotGame("nightWalkAgb/jump" + (int)type); + if (doFillStartSound) SoundByte.PlayOneShotGame("nightWalkAgb/fillStart"); + else SoundByte.PlayOneShotGame("nightWalkAgb/jump" + (int)type); switch (type) { case PlatformType.Flower: