diff --git a/Assets/Resources/Games/nightWalkAgb.prefab b/Assets/Resources/Games/nightWalkAgb.prefab index 4c2d6d6a3..97f81dd9e 100644 --- a/Assets/Resources/Games/nightWalkAgb.prefab +++ b/Assets/Resources/Games/nightWalkAgb.prefab @@ -78,9 +78,10 @@ MonoBehaviour: m_EditorClassIdentifier: platformRef: {fileID: 1558448204157038467, guid: 73364b4dafdbd914f83c316a1fcf8dd7, type: 3} defaultYPos: -11.76 + heightAmount: 2 platformDistance: 3.8 playerXPos: -6.78 - platformCount: 15 + platformCount: 16 --- !u!1 &955264990193298390 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs b/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs index 72a32c1df..ce442f5a0 100644 --- a/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs +++ b/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs @@ -15,7 +15,7 @@ namespace HeavenStudio.Games.Loaders { return new Minigame("nightWalkAgb", "Night Walk (GBA)", "FFFFFF", false, false, new List() { - new GameAction("countIn", "Count In") + new GameAction("countIn", "8 Beat Count-In") { preFunction = delegate { if (!eventCaller.currentEntity["mute"] && AgbNightWalk.IsValidCountIn(eventCaller.currentEntity)) AgbNightWalk.CountInSound(eventCaller.currentEntity.beat); }, defaultLength = 8, @@ -50,7 +50,12 @@ namespace HeavenStudio.Games [NonSerialized] public double countInBeat = -1; [Header("Curves")] [SerializeField] SuperCurveObject.Path[] jumpPaths; - [NonSerialized] public Dictionary platformHeightChanges = new Dictionary(); + private struct HeightEvent + { + public double beat; + public int value; + } + List heightEntityEvents = new(); new void OnDrawGizmos() { @@ -80,20 +85,27 @@ namespace HeavenStudio.Games { instance = this; List heightEvents = EventCaller.GetAllInGameManagerList("nightWalkAgb", new string[] { "height" }); - foreach (var height in heightEvents) + foreach (var heightEvent in heightEvents) { - int randomValue = UnityEngine.Random.Range(height["rmin"], height["rmax"]); - if (platformHeightChanges.ContainsKey(height.beat)) + heightEntityEvents.Add(new HeightEvent() { - platformHeightChanges[height.beat] += height["value"] + randomValue; - } - else - { - platformHeightChanges.Add(height.beat, height["value"] + randomValue); - } + beat = heightEvent.beat, + value = heightEvent["value"] + UnityEngine.Random.Range(heightEvent["rmin"], heightEvent["rmax"] + 1) + }); } } + public int FindHeightUnitsAtBeat(double beat) + { + List tempEvents = heightEntityEvents.FindAll(e => e.beat <= beat); + int height = 0; + foreach (var heightEvent in tempEvents) + { + height += heightEvent.value; + } + return height; + } + public override void OnGameSwitch(double beat) { SetCountInBeat(beat); diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs b/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs index 03cbbbf38..8ef2a0580 100644 --- a/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs +++ b/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs @@ -32,21 +32,10 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk public void StartInput(double beat, double hitBeat) { if (game == null) game = AgbNightWalk.instance; - if (game.platformHeightChanges.ContainsKey(hitBeat)) - { - handler.defaultHeightUnits += game.platformHeightChanges[hitBeat]; - } - lastAdditionalHeightInUnits = handler.defaultHeightUnits; - additionalHeight = handler.defaultHeightUnits * handler.heightAmount; - if (game.platformHeightChanges.ContainsKey(hitBeat + 1)) - { - additionalHeightInUnits = lastAdditionalHeightInUnits + game.platformHeightChanges[hitBeat + 1]; - } - else - { - additionalHeightInUnits = lastAdditionalHeightInUnits; - } - platform.SetActive(!game.platformHeightChanges.ContainsKey(hitBeat + 1)); + lastAdditionalHeightInUnits = game.FindHeightUnitsAtBeat(hitBeat); + additionalHeightInUnits = game.FindHeightUnitsAtBeat(hitBeat + 1); + additionalHeight = lastAdditionalHeightInUnits * handler.heightAmount; + platform.SetActive(lastAdditionalHeightInUnits == additionalHeightInUnits); startBeat = beat; endBeat = hitBeat; if (startBeat < endBeat) diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbPlatformHandler.cs b/Assets/Scripts/Games/NightWalkAgb/AgbPlatformHandler.cs index 77e68238a..d4bc2f899 100644 --- a/Assets/Scripts/Games/NightWalkAgb/AgbPlatformHandler.cs +++ b/Assets/Scripts/Games/NightWalkAgb/AgbPlatformHandler.cs @@ -13,7 +13,6 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk [SerializeField] private AgbPlatform platformRef; public float defaultYPos = -11.76f; public float heightAmount = 2; - [NonSerialized] public int defaultHeightUnits = 0; public float platformDistance = 3.80f; public float playerXPos = -6.78f; [Range(1, 100)]