From 731f7bef17f77f5dbcc49ab520b08c4d388619a0 Mon Sep 17 00:00:00 2001
From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com>
Date: Sun, 25 Jun 2023 17:05:08 +0200
Subject: [PATCH] end event functionality finished
---
.../Games/NightWalkAgb/JumpPlatform.prefab | 2 +-
.../Games/NightWalkAgb/AgbNightWalk.cs | 4 +-
.../Scripts/Games/NightWalkAgb/AgbPlatform.cs | 75 ++++++++++++++++---
.../Scripts/Games/NightWalkAgb/AgbPlayYan.cs | 2 +-
4 files changed, 68 insertions(+), 15 deletions(-)
diff --git a/Assets/Resources/Prefabs/Games/NightWalkAgb/JumpPlatform.prefab b/Assets/Resources/Prefabs/Games/NightWalkAgb/JumpPlatform.prefab
index 9cf6f6e0a..32252d8fb 100644
--- a/Assets/Resources/Prefabs/Games/NightWalkAgb/JumpPlatform.prefab
+++ b/Assets/Resources/Prefabs/Games/NightWalkAgb/JumpPlatform.prefab
@@ -241,7 +241,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
- m_IsActive: 1
+ m_IsActive: 0
--- !u!4 &9016694733661613840
Transform:
m_ObjectHideFlags: 0
diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs b/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs
index e9de892d4..aa27c58de 100644
--- a/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs
+++ b/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs
@@ -72,8 +72,8 @@ namespace HeavenStudio.Games.Loaders
{
parameters = new List()
{
- new Param("minAmount", new EntityTypes.Integer(0, 10000, 20), "Minimum Jumps Required"),
- new Param("minAmountP", new EntityTypes.Integer(0, 10000, 100), "Minimum Jumps Required (Persistent)"),
+ new Param("minAmount", new EntityTypes.Integer(0, 10000, 10), "Minimum Jumps Required"),
+ new Param("minAmountP", new EntityTypes.Integer(0, 10000, 0), "Minimum Jumps Required (Persistent)"),
}
},
new GameAction("noJump", "No Jumping")
diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs b/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs
index 1038214a6..f93908d78 100644
--- a/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs
+++ b/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs
@@ -38,6 +38,7 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
private bool playYanIsFalling;
private double playYanFallBeat;
private bool isFish;
+ private bool isFinalBlock;
public void StartInput(double beat, double hitBeat)
{
@@ -46,11 +47,13 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
additionalHeightInUnits = game.FindHeightUnitsAtBeat(hitBeat + 1);
additionalHeight = lastAdditionalHeightInUnits * handler.heightAmount;
bool nextPlatformIsSameHeight = lastAdditionalHeightInUnits == additionalHeightInUnits;
- platform.SetActive(nextPlatformIsSameHeight);
+ isFinalBlock = hitBeat == game.endBeat + 1;
+ platform.SetActive(nextPlatformIsSameHeight && !isFinalBlock);
startBeat = beat;
endBeat = hitBeat;
isFish = game.FishOnBeat(endBeat);
fish.gameObject.SetActive(isFish);
+ bool isEndEvent = game.endBeat == endBeat;
if (game.platformTypes.ContainsKey(hitBeat))
{
if (game.platformTypes[hitBeat].platformType == AgbNightWalk.PlatformType.Lollipop)
@@ -75,8 +78,8 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
{
if (game.ShouldNotJumpOnBeat(endBeat) || isFish)
{
- inputEvent = AgbNightWalk.instance.ScheduleUserInput(startBeat, endBeat - startBeat, InputType.STANDARD_DOWN, Just, Miss, Empty);
- if (nextPlatformIsSameHeight)
+ inputEvent = AgbNightWalk.instance.ScheduleUserInput(startBeat, endBeat - startBeat, InputType.STANDARD_DOWN, isEndEvent ? JustEnd : Just, Miss, Empty);
+ if (nextPlatformIsSameHeight && !isFinalBlock)
{
BeatAction.New(gameObject, new List()
{
@@ -118,7 +121,7 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
}
else if (!isFish)
{
- inputEvent = AgbNightWalk.instance.ScheduleInput(startBeat, endBeat - startBeat, InputType.STANDARD_DOWN, Just, Miss, Empty);
+ inputEvent = AgbNightWalk.instance.ScheduleInput(startBeat, endBeat - startBeat, InputType.STANDARD_DOWN, isEndEvent ? JustEnd : Just, Miss, Empty);
}
if (nextPlatformIsSameHeight)
{
@@ -199,8 +202,11 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
private void ResetInput()
{
double newStartBeat = endBeat + (handler.platformCount * 0.5f);
- anim.Play("Idle", 0, 0);
- StartInput(newStartBeat, newStartBeat + (handler.platformCount * 0.5f));
+ if (newStartBeat + (handler.platformCount * 0.5f) <= game.endBeat + 1)
+ {
+ anim.Play("Idle", 0, 0);
+ StartInput(newStartBeat, newStartBeat + (handler.platformCount * 0.5f));
+ }
}
private void Just(PlayerActionEvent caller, float state)
{
@@ -227,6 +233,20 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
})
});
}
+ else if (isFinalBlock)
+ {
+ BeatAction.New(gameObject, new List()
+ {
+ new BeatAction.Action(beat + 0.5, delegate
+ {
+ game.ScoreMiss();
+ handler.StopAll();
+ game.playYan.Fall(beat + 0.5);
+ handler.DestroyPlatforms(caller.timer + caller.startBeat + 2, endBeat - 2, endBeat);
+ }),
+
+ });
+ }
if (state >= 1 || state <= -1)
{
SoundByte.PlayOneShotGame("nightWalkAgb/ng");
@@ -265,11 +285,44 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
private void JustEnd(PlayerActionEvent caller, float state)
{
- anim.DoScaledAnimationAsync("EndPop", 0.5f);
- handler.StopAll();
- handler.DestroyPlatforms(caller.timer + caller.startBeat + 4, endBeat - 2, endBeat + 1);
- game.playYan.Float(Conductor.instance.songPositionInBeats);
- handler.DevolveAll();
+ double beat = caller.timer + caller.startBeat;
+ if (game.hitJumps >= game.requiredJumps && AgbNightWalk.hitJumpsPersist >= game.requiredJumpsP)
+ {
+ anim.DoScaledAnimationAsync("EndPop", 0.5f);
+ handler.StopAll();
+ handler.DestroyPlatforms(caller.timer + caller.startBeat + 4, endBeat - 2, endBeat + 1);
+ game.playYan.Float(Conductor.instance.songPositionInBeats);
+ handler.DevolveAll();
+ if (isFish)
+ {
+ BeatAction.New(gameObject, new List()
+ {
+ new BeatAction.Action(beat + 0.5, delegate
+ {
+ game.ScoreMiss();
+ game.playYan.Shock();
+ fish.DoScaledAnimationAsync("Shock", 0.5f);
+ }),
+ new BeatAction.Action(caller.timer + caller.startBeat + 4, delegate
+ {
+ game.playYan.Fall(caller.timer + caller.startBeat + 4);
+ fish.DoScaledAnimationAsync("FishIdle", 0.5f);
+ })
+ });
+ }
+ }
+ else
+ {
+ game.playYan.Whiff(Conductor.instance.songPositionInBeats);
+ game.ScoreMiss();
+ if (!platform.activeSelf)
+ {
+ BeatAction.New(gameObject, new List()
+ {
+ new BeatAction.Action(beat + Conductor.instance.SecsToBeats(Minigame.lateTime, Conductor.instance.GetBpmAtBeat(beat)), delegate { Miss(caller); })
+ });
+ }
+ }
}
private void Miss(PlayerActionEvent caller)
diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbPlayYan.cs b/Assets/Scripts/Games/NightWalkAgb/AgbPlayYan.cs
index 35f77ee67..8ebdff937 100644
--- a/Assets/Scripts/Games/NightWalkAgb/AgbPlayYan.cs
+++ b/Assets/Scripts/Games/NightWalkAgb/AgbPlayYan.cs
@@ -104,7 +104,6 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
{
jumpingState = JumpingState.Shocked;
anim.DoScaledAnimationAsync("Shock", 0.5f);
- fallStartY = transform.localPosition.y;
SoundByte.PlayOneShotGame("nightWalkAgb/shock");
}
@@ -113,6 +112,7 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
jumpingState = JumpingState.Falling;
anim.Play("Jump", 0, 0);
playYanFallBeat = beat;
+ fallStartY = transform.localPosition.y;
SoundByte.PlayOneShotGame("nightWalkAgb/fall");
Update();
}