From 0138c0d6a7e1d9099146b63fc529cddaec21cb69 Mon Sep 17 00:00:00 2001 From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:12:36 +0100 Subject: [PATCH] added jump option --- Assets/Scripts/Games/DoubleDate/Basketball.cs | 6 +- Assets/Scripts/Games/DoubleDate/DoubleDate.cs | 58 ++++++++++++------- Assets/Scripts/Games/DoubleDate/Football.cs | 6 +- Assets/Scripts/Games/DoubleDate/SoccerBall.cs | 6 +- 4 files changed, 49 insertions(+), 27 deletions(-) diff --git a/Assets/Scripts/Games/DoubleDate/Basketball.cs b/Assets/Scripts/Games/DoubleDate/Basketball.cs index 204de9aec..33b28abbd 100644 --- a/Assets/Scripts/Games/DoubleDate/Basketball.cs +++ b/Assets/Scripts/Games/DoubleDate/Basketball.cs @@ -15,6 +15,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate private double pathStartBeat = double.MinValue; private Conductor conductor; private GameObject shadow; + private bool _jump; void Awake() { @@ -37,8 +38,9 @@ namespace HeavenStudio.Games.Scripts_DoubleDate shadow.transform.localScale = Vector3.one * Mathf.Clamp(((transform.position.y) - game.shadowDepthScaleMin) / (game.shadowDepthScaleMax - game.shadowDepthScaleMin), 0f, 1f); } - public void Init(double beat) + public void Init(double beat, bool shouldJump) { + _jump = shouldJump; game.ScheduleInput(beat, 1f, DoubleDate.InputAction_FlickPress, Just, Miss, Empty); path = game.GetPath("BasketBallIn"); UpdateLastRealPos(); @@ -80,7 +82,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate UpdateLastRealPos(); pathStartBeat = conductor.songPositionInBeatsAsDouble; path = game.GetPath("BasketBallJust"); - game.Kick(); + game.Kick(true, false, true, _jump); SoundByte.PlayOneShotGame("doubleDate/kick"); } diff --git a/Assets/Scripts/Games/DoubleDate/DoubleDate.cs b/Assets/Scripts/Games/DoubleDate/DoubleDate.cs index 59d295588..46c470d9c 100644 --- a/Assets/Scripts/Games/DoubleDate/DoubleDate.cs +++ b/Assets/Scripts/Games/DoubleDate/DoubleDate.cs @@ -23,21 +23,33 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("soccer", "Soccer Ball") { - preFunction = delegate { var e = eventCaller.currentEntity; DoubleDate.QueueSoccerBall(e.beat); }, + preFunction = delegate { var e = eventCaller.currentEntity; DoubleDate.QueueSoccerBall(e.beat, e["b"]); }, preFunctionLength = 1f, defaultLength = 2f, + parameters = new() + { + new("b", false, "Weasels Jump") + } }, new GameAction("basket", "Basket Ball") { - preFunction = delegate { var e = eventCaller.currentEntity; DoubleDate.QueueBasketBall(e.beat); }, + preFunction = delegate { var e = eventCaller.currentEntity; DoubleDate.QueueBasketBall(e.beat, e["b"]); }, preFunctionLength = 1f, defaultLength = 2f, + parameters = new() + { + new("b", false, "Weasels Jump") + } }, new GameAction("football", "Football") { - preFunction = delegate { var e = eventCaller.currentEntity; DoubleDate.QueueFootBall(e.beat); }, + preFunction = delegate { var e = eventCaller.currentEntity; DoubleDate.QueueFootBall(e.beat, e["b"]); }, preFunctionLength = 1f, defaultLength = 2.5f, + parameters = new() + { + new("b", true, "Weasels Jump") + } }, new GameAction("blush", "Blush") { @@ -136,6 +148,7 @@ namespace HeavenStudio.Games { public double beat; public BallType type; + public bool jump; } public static PlayerInput.InputAction InputAction_TouchPress = @@ -258,13 +271,13 @@ namespace HeavenStudio.Games switch (ball.type) { case BallType.Soccer: - SpawnSoccerBall(ball.beat); + SpawnSoccerBall(ball.beat, ball.jump); break; case BallType.Basket: - SpawnBasketBall(ball.beat); + SpawnBasketBall(ball.beat, ball.jump); break; case BallType.Football: - SpawnFootBall(ball.beat); + SpawnFootBall(ball.beat, ball.jump); break; } } @@ -375,36 +388,38 @@ namespace HeavenStudio.Games } } - public static void QueueSoccerBall(double beat) + public static void QueueSoccerBall(double beat, bool shouldJump) { if (GameManager.instance.currentGame != "doubleDate") { queuedBalls.Add(new QueuedBall() { beat = beat, - type = BallType.Soccer + type = BallType.Soccer, + jump = shouldJump }); } else { - instance.SpawnSoccerBall(beat); + instance.SpawnSoccerBall(beat, shouldJump); } SoundByte.PlayOneShotGame("doubleDate/soccerBounce", beat, forcePlay: true); } - public static void QueueBasketBall(double beat) + public static void QueueBasketBall(double beat, bool shouldJump) { if (GameManager.instance.currentGame != "doubleDate") { queuedBalls.Add(new QueuedBall() { beat = beat, - type = BallType.Basket + type = BallType.Basket, + jump = shouldJump }); } else { - instance.SpawnBasketBall(beat); + instance.SpawnBasketBall(beat, shouldJump); } MultiSound.Play(new MultiSound.Sound[] { @@ -413,19 +428,20 @@ namespace HeavenStudio.Games }, forcePlay: true); } - public static void QueueFootBall(double beat) + public static void QueueFootBall(double beat, bool shouldJump) { if (GameManager.instance.currentGame != "doubleDate") { queuedBalls.Add(new QueuedBall() { beat = beat, - type = BallType.Football + type = BallType.Football, + jump = shouldJump }); } else { - instance.SpawnFootBall(beat); + instance.SpawnFootBall(beat, shouldJump); } MultiSound.Play(new MultiSound.Sound[] { @@ -434,22 +450,22 @@ namespace HeavenStudio.Games }, forcePlay: true); } - public void SpawnSoccerBall(double beat) + public void SpawnSoccerBall(double beat, bool shouldJump) { SoccerBall spawnedBall = Instantiate(soccer, instance.transform).GetComponent(); - spawnedBall.Init(beat); + spawnedBall.Init(beat, shouldJump); } - public void SpawnBasketBall(double beat) + public void SpawnBasketBall(double beat, bool shouldJump) { Basketball spawnedBall = Instantiate(basket, instance.transform).GetComponent(); - spawnedBall.Init(beat); + spawnedBall.Init(beat, shouldJump); } - public void SpawnFootBall(double beat) + public void SpawnFootBall(double beat, bool shouldJump) { Football spawnedBall = Instantiate(football, instance.transform).GetComponent(); - spawnedBall.Init(beat); + spawnedBall.Init(beat, shouldJump); } public void MissKick(double beat, bool hit = false) diff --git a/Assets/Scripts/Games/DoubleDate/Football.cs b/Assets/Scripts/Games/DoubleDate/Football.cs index e3780508b..b0f025e07 100644 --- a/Assets/Scripts/Games/DoubleDate/Football.cs +++ b/Assets/Scripts/Games/DoubleDate/Football.cs @@ -15,6 +15,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate private double pathStartBeat = double.MinValue; private Conductor conductor; private GameObject shadow; + private bool _jump; void Awake() { @@ -37,8 +38,9 @@ namespace HeavenStudio.Games.Scripts_DoubleDate shadow.transform.localScale = Vector3.one * Mathf.Clamp(((transform.position.y) - game.shadowDepthScaleMin) / (game.shadowDepthScaleMax - game.shadowDepthScaleMin), 0f, 1f); } - public void Init(double beat) + public void Init(double beat, bool shouldJump) { + _jump = shouldJump; game.ScheduleInput(beat, 1.5f, DoubleDate.InputAction_FlickPress, Just, Miss, Empty); path = game.GetPath("FootBallInNoHit"); // there's a second path for footballs that hit the weasels, use that if the weasels haven't been hit recently UpdateLastRealPos(); @@ -96,7 +98,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate UpdateLastRealPos(); pathStartBeat = conductor.songPositionInBeatsAsDouble; path = game.GetPath("FootBallJust"); - game.Kick(true, true, jump: true); + game.Kick(true, true, jump: _jump); SoundByte.PlayOneShotGame("doubleDate/footballKick"); } diff --git a/Assets/Scripts/Games/DoubleDate/SoccerBall.cs b/Assets/Scripts/Games/DoubleDate/SoccerBall.cs index 934ca7726..93fba73d9 100644 --- a/Assets/Scripts/Games/DoubleDate/SoccerBall.cs +++ b/Assets/Scripts/Games/DoubleDate/SoccerBall.cs @@ -15,6 +15,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate private double pathStartBeat = double.MinValue; private Conductor conductor; private GameObject shadow; + private bool _jump; void Awake() { @@ -37,8 +38,9 @@ namespace HeavenStudio.Games.Scripts_DoubleDate shadow.transform.localScale = Vector3.one * Mathf.Clamp(((transform.position.y) - game.shadowDepthScaleMin) / (game.shadowDepthScaleMax - game.shadowDepthScaleMin), 0f, 1f); } - public void Init(double beat) + public void Init(double beat, bool shouldJump) { + _jump = shouldJump; game.ScheduleInput(beat, 1f, DoubleDate.InputAction_FlickPress, Just, Miss, Empty); path = game.GetPath("SoccerIn"); UpdateLastRealPos(); @@ -80,7 +82,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate UpdateLastRealPos(); pathStartBeat = conductor.songPositionInBeatsAsDouble; path = game.GetPath("SoccerJust"); - game.Kick(); + game.Kick(true, false, true, _jump); SoundByte.PlayOneShotGame("doubleDate/kick"); }