added jump option

This commit is contained in:
Rapandrasmus 2023-12-12 17:12:36 +01:00
parent 2a7e95d6b2
commit 0138c0d6a7
4 changed files with 49 additions and 27 deletions

View file

@ -15,6 +15,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
private double pathStartBeat = double.MinValue; private double pathStartBeat = double.MinValue;
private Conductor conductor; private Conductor conductor;
private GameObject shadow; private GameObject shadow;
private bool _jump;
void Awake() 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); 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); game.ScheduleInput(beat, 1f, DoubleDate.InputAction_FlickPress, Just, Miss, Empty);
path = game.GetPath("BasketBallIn"); path = game.GetPath("BasketBallIn");
UpdateLastRealPos(); UpdateLastRealPos();
@ -80,7 +82,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
UpdateLastRealPos(); UpdateLastRealPos();
pathStartBeat = conductor.songPositionInBeatsAsDouble; pathStartBeat = conductor.songPositionInBeatsAsDouble;
path = game.GetPath("BasketBallJust"); path = game.GetPath("BasketBallJust");
game.Kick(); game.Kick(true, false, true, _jump);
SoundByte.PlayOneShotGame("doubleDate/kick"); SoundByte.PlayOneShotGame("doubleDate/kick");
} }

View file

@ -23,21 +23,33 @@ namespace HeavenStudio.Games.Loaders
}, },
new GameAction("soccer", "Soccer Ball") 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, preFunctionLength = 1f,
defaultLength = 2f, defaultLength = 2f,
parameters = new()
{
new("b", false, "Weasels Jump")
}
}, },
new GameAction("basket", "Basket Ball") 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, preFunctionLength = 1f,
defaultLength = 2f, defaultLength = 2f,
parameters = new()
{
new("b", false, "Weasels Jump")
}
}, },
new GameAction("football", "Football") 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, preFunctionLength = 1f,
defaultLength = 2.5f, defaultLength = 2.5f,
parameters = new()
{
new("b", true, "Weasels Jump")
}
}, },
new GameAction("blush", "Blush") new GameAction("blush", "Blush")
{ {
@ -136,6 +148,7 @@ namespace HeavenStudio.Games
{ {
public double beat; public double beat;
public BallType type; public BallType type;
public bool jump;
} }
public static PlayerInput.InputAction InputAction_TouchPress = public static PlayerInput.InputAction InputAction_TouchPress =
@ -258,13 +271,13 @@ namespace HeavenStudio.Games
switch (ball.type) switch (ball.type)
{ {
case BallType.Soccer: case BallType.Soccer:
SpawnSoccerBall(ball.beat); SpawnSoccerBall(ball.beat, ball.jump);
break; break;
case BallType.Basket: case BallType.Basket:
SpawnBasketBall(ball.beat); SpawnBasketBall(ball.beat, ball.jump);
break; break;
case BallType.Football: case BallType.Football:
SpawnFootBall(ball.beat); SpawnFootBall(ball.beat, ball.jump);
break; 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") if (GameManager.instance.currentGame != "doubleDate")
{ {
queuedBalls.Add(new QueuedBall() queuedBalls.Add(new QueuedBall()
{ {
beat = beat, beat = beat,
type = BallType.Soccer type = BallType.Soccer,
jump = shouldJump
}); });
} }
else else
{ {
instance.SpawnSoccerBall(beat); instance.SpawnSoccerBall(beat, shouldJump);
} }
SoundByte.PlayOneShotGame("doubleDate/soccerBounce", beat, forcePlay: true); 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") if (GameManager.instance.currentGame != "doubleDate")
{ {
queuedBalls.Add(new QueuedBall() queuedBalls.Add(new QueuedBall()
{ {
beat = beat, beat = beat,
type = BallType.Basket type = BallType.Basket,
jump = shouldJump
}); });
} }
else else
{ {
instance.SpawnBasketBall(beat); instance.SpawnBasketBall(beat, shouldJump);
} }
MultiSound.Play(new MultiSound.Sound[] MultiSound.Play(new MultiSound.Sound[]
{ {
@ -413,19 +428,20 @@ namespace HeavenStudio.Games
}, forcePlay: true); }, forcePlay: true);
} }
public static void QueueFootBall(double beat) public static void QueueFootBall(double beat, bool shouldJump)
{ {
if (GameManager.instance.currentGame != "doubleDate") if (GameManager.instance.currentGame != "doubleDate")
{ {
queuedBalls.Add(new QueuedBall() queuedBalls.Add(new QueuedBall()
{ {
beat = beat, beat = beat,
type = BallType.Football type = BallType.Football,
jump = shouldJump
}); });
} }
else else
{ {
instance.SpawnFootBall(beat); instance.SpawnFootBall(beat, shouldJump);
} }
MultiSound.Play(new MultiSound.Sound[] MultiSound.Play(new MultiSound.Sound[]
{ {
@ -434,22 +450,22 @@ namespace HeavenStudio.Games
}, forcePlay: true); }, forcePlay: true);
} }
public void SpawnSoccerBall(double beat) public void SpawnSoccerBall(double beat, bool shouldJump)
{ {
SoccerBall spawnedBall = Instantiate(soccer, instance.transform).GetComponent<SoccerBall>(); SoccerBall spawnedBall = Instantiate(soccer, instance.transform).GetComponent<SoccerBall>();
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<Basketball>(); Basketball spawnedBall = Instantiate(basket, instance.transform).GetComponent<Basketball>();
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<Football>(); Football spawnedBall = Instantiate(football, instance.transform).GetComponent<Football>();
spawnedBall.Init(beat); spawnedBall.Init(beat, shouldJump);
} }
public void MissKick(double beat, bool hit = false) public void MissKick(double beat, bool hit = false)

View file

@ -15,6 +15,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
private double pathStartBeat = double.MinValue; private double pathStartBeat = double.MinValue;
private Conductor conductor; private Conductor conductor;
private GameObject shadow; private GameObject shadow;
private bool _jump;
void Awake() 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); 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); 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 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(); UpdateLastRealPos();
@ -96,7 +98,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
UpdateLastRealPos(); UpdateLastRealPos();
pathStartBeat = conductor.songPositionInBeatsAsDouble; pathStartBeat = conductor.songPositionInBeatsAsDouble;
path = game.GetPath("FootBallJust"); path = game.GetPath("FootBallJust");
game.Kick(true, true, jump: true); game.Kick(true, true, jump: _jump);
SoundByte.PlayOneShotGame("doubleDate/footballKick"); SoundByte.PlayOneShotGame("doubleDate/footballKick");
} }

View file

@ -15,6 +15,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
private double pathStartBeat = double.MinValue; private double pathStartBeat = double.MinValue;
private Conductor conductor; private Conductor conductor;
private GameObject shadow; private GameObject shadow;
private bool _jump;
void Awake() 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); 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); game.ScheduleInput(beat, 1f, DoubleDate.InputAction_FlickPress, Just, Miss, Empty);
path = game.GetPath("SoccerIn"); path = game.GetPath("SoccerIn");
UpdateLastRealPos(); UpdateLastRealPos();
@ -80,7 +82,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
UpdateLastRealPos(); UpdateLastRealPos();
pathStartBeat = conductor.songPositionInBeatsAsDouble; pathStartBeat = conductor.songPositionInBeatsAsDouble;
path = game.GetPath("SoccerJust"); path = game.GetPath("SoccerJust");
game.Kick(); game.Kick(true, false, true, _jump);
SoundByte.PlayOneShotGame("doubleDate/kick"); SoundByte.PlayOneShotGame("doubleDate/kick");
} }