From 1d4fc52e374cd0459480a5f8836f235d2f976925 Mon Sep 17 00:00:00 2001 From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Date: Mon, 26 Jun 2023 13:36:45 +0200 Subject: [PATCH] Roll cue platform visuals done --- .../Games/NightWalkAgb/JumpPlatform.prefab | 5 +- .../Games/NightWalkAgb/AgbNightWalk.cs | 11 +++ .../Scripts/Games/NightWalkAgb/AgbPlatform.cs | 93 +++++++++++-------- 3 files changed, 67 insertions(+), 42 deletions(-) diff --git a/Assets/Resources/Prefabs/Games/NightWalkAgb/JumpPlatform.prefab b/Assets/Resources/Prefabs/Games/NightWalkAgb/JumpPlatform.prefab index e5fe93872..7945e1b09 100644 --- a/Assets/Resources/Prefabs/Games/NightWalkAgb/JumpPlatform.prefab +++ b/Assets/Resources/Prefabs/Games/NightWalkAgb/JumpPlatform.prefab @@ -277,6 +277,7 @@ MonoBehaviour: platform: {fileID: 8602790381015410525} fallYan: {fileID: 142440390168805750} fish: {fileID: 3392966659349309181} + rollPlatform: {fileID: 3096308579732643404} --- !u!95 &4653690538679061971 Animator: serializedVersion: 5 @@ -1000,7 +1001,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4921680285842369143} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 4.4, y: 6.48, z: 0} + m_LocalPosition: {x: 4.7253, y: 6.48, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -1053,7 +1054,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 1 - m_Size: {x: 3.78, y: 0.43} + m_Size: {x: 4.430684, y: 0.43} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 1 diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs b/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs index 306f187cd..7f99efda7 100644 --- a/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs +++ b/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs @@ -148,6 +148,7 @@ namespace HeavenStudio.Games List heightEntityEvents = new(); [NonSerialized] public Dictionary platformTypes = new(); private List fishBeats = new(); + private List rollBeats = new(); public struct TypeEvent { public PlatformType platformType; @@ -218,6 +219,11 @@ namespace HeavenStudio.Games { fishBeats.Add(fishEvent.beat); } + List rollEvents = EventCaller.GetAllInGameManagerList("nightWalkAgb", new string[] { "roll" }); + foreach (var rollEvent in rollEvents) + { + rollBeats.Add(rollEvent.beat); + } } private void OnDestroy() @@ -247,6 +253,11 @@ namespace HeavenStudio.Games return fishBeats.Contains(beat); } + public bool RollOnBeat(double beat) + { + return rollBeats.Contains(beat); + } + public int FindHeightUnitsAtBeat(double beat) { List tempEvents = heightEntityEvents.FindAll(e => e.beat <= beat); diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs b/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs index 13bfc7eb5..09d9c9419 100644 --- a/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs +++ b/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs @@ -35,11 +35,14 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk [NonSerialized] public bool stopped; [SerializeField] private GameObject fallYan; [SerializeField] private Animator fish; + [SerializeField] private GameObject rollPlatform; private bool playYanIsFalling; private double playYanFallBeat; private bool isFish; private bool isFinalBlock; private bool isEndEvent; + private bool nextPlatformIsSameHeight; + private bool isRollPlatform; public void StartInput(double beat, double hitBeat) { @@ -47,43 +50,52 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk lastAdditionalHeightInUnits = game.FindHeightUnitsAtBeat(hitBeat); additionalHeightInUnits = game.FindHeightUnitsAtBeat(hitBeat + 1); additionalHeight = lastAdditionalHeightInUnits * handler.heightAmount; - bool nextPlatformIsSameHeight = lastAdditionalHeightInUnits == additionalHeightInUnits; + nextPlatformIsSameHeight = lastAdditionalHeightInUnits == additionalHeightInUnits; isFinalBlock = hitBeat == game.endBeat + 1; platform.SetActive(nextPlatformIsSameHeight && !isFinalBlock); startBeat = beat; endBeat = hitBeat; + if (game.RollOnBeat(endBeat - 1)) endBeat += handler.platformCount; isFish = game.FishOnBeat(endBeat); fish.gameObject.SetActive(isFish); isEndEvent = game.endBeat == endBeat; if (isEndEvent) anim.Play("EndIdle", 0, 0); - if (game.platformTypes.ContainsKey(hitBeat)) + isRollPlatform = !isEndEvent && game.RollOnBeat(endBeat); + rollPlatform.SetActive(isRollPlatform); + if (isRollPlatform) { - if (game.platformTypes[hitBeat].platformType == AgbNightWalk.PlatformType.Lollipop) - { - type = PlatformType.Lollipop; - } - else - { - type = PlatformType.Umbrella; - } - doFillStartSound = false; + platform.SetActive(false); } else { - type = PlatformType.Flower; - if (game.platformTypes.ContainsKey(hitBeat + 1)) - { - doFillStartSound = game.platformTypes[hitBeat + 1].fillType != AgbNightWalk.FillType.None; - } - } - if (startBeat < endBeat) - { - if (game.ShouldNotJumpOnBeat(endBeat) || isFish) + if (game.platformTypes.ContainsKey(hitBeat)) { - inputEvent = AgbNightWalk.instance.ScheduleUserInput(startBeat, endBeat - startBeat, InputType.STANDARD_DOWN, isEndEvent ? JustEnd : Just, Miss, Empty); - if (nextPlatformIsSameHeight && !isFinalBlock) + if (game.platformTypes[hitBeat].platformType == AgbNightWalk.PlatformType.Lollipop) { - BeatAction.New(gameObject, new List() + type = PlatformType.Lollipop; + } + else + { + 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) + { + if (game.ShouldNotJumpOnBeat(endBeat) || isFish) + { + inputEvent = AgbNightWalk.instance.ScheduleUserInput(startBeat, endBeat - startBeat, InputType.STANDARD_DOWN, isEndEvent ? JustEnd : Just, Miss, Empty); + if (nextPlatformIsSameHeight && !isFinalBlock) + { + BeatAction.New(gameObject, new List() { new BeatAction.Action(endBeat, delegate { @@ -101,10 +113,10 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk } }) }); - } - else - { - BeatAction.New(gameObject, new List() + } + else + { + BeatAction.New(gameObject, new List() { new BeatAction.Action(endBeat, delegate { @@ -119,19 +131,19 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk } }) }); + } } - } - else if (!isFish) - { - inputEvent = AgbNightWalk.instance.ScheduleInput(startBeat, endBeat - startBeat, InputType.STANDARD_DOWN, isEndEvent ? JustEnd : Just, Miss, Empty); - } - if (nextPlatformIsSameHeight && !isEndEvent) - { - canKick = true; - BeatAction.New(gameObject, new List() + else if (!isFish) { - new BeatAction.Action(endBeat, delegate - { + inputEvent = AgbNightWalk.instance.ScheduleInput(startBeat, endBeat - startBeat, InputType.STANDARD_DOWN, isEndEvent ? JustEnd : Just, Miss, Empty); + } + if (nextPlatformIsSameHeight && !isEndEvent) + { + canKick = true; + BeatAction.New(gameObject, new List() + { + new BeatAction.Action(endBeat, delegate + { if (!stopped) { SoundByte.PlayOneShotGame("nightWalkAgb/boxKick"); @@ -142,8 +154,9 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk } }) }); - } + } + } } } @@ -330,7 +343,7 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk private void Miss(PlayerActionEvent caller) { - if (platform.activeSelf) + if (nextPlatformIsSameHeight) { game.playYan.Walk(); SoundByte.PlayOneShotGame("nightWalkAgb/open" + (int)type, caller.timer + caller.startBeat + 0.5);