make cue sounds play properly (#398)

This commit is contained in:
minenice55 2023-04-22 15:39:54 -04:00 committed by GitHub
parent eb4f25e9b7
commit 98401cb786

View file

@ -24,16 +24,19 @@ 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); },
preFunctionLength = 1f,
defaultLength = 2f, defaultLength = 2f,
}, },
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); },
preFunctionLength = 1f,
defaultLength = 2f, defaultLength = 2f,
}, },
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); },
preFunctionLength = 1f,
defaultLength = 2.5f, defaultLength = 2.5f,
}, },
}); });
@ -107,6 +110,10 @@ namespace HeavenStudio.Games
queuedBalls.Clear(); queuedBalls.Clear();
} }
private void OnDestroy() {
queuedBalls.Clear();
}
private void Awake() private void Awake()
{ {
instance = this; instance = this;
@ -224,7 +231,7 @@ namespace HeavenStudio.Games
public static void QueueSoccerBall(float beat) public static void QueueSoccerBall(float beat)
{ {
if (instance == null) if (GameManager.instance.currentGame != "doubleDate")
{ {
queuedBalls.Add(new QueuedBall() queuedBalls.Add(new QueuedBall()
{ {
@ -241,7 +248,7 @@ namespace HeavenStudio.Games
public static void QueueBasketBall(float beat) public static void QueueBasketBall(float beat)
{ {
if (instance == null) if (GameManager.instance.currentGame != "doubleDate")
{ {
queuedBalls.Add(new QueuedBall() queuedBalls.Add(new QueuedBall()
{ {
@ -257,12 +264,12 @@ namespace HeavenStudio.Games
{ {
new MultiSound.Sound("doubleDate/basketballBounce", beat), new MultiSound.Sound("doubleDate/basketballBounce", beat),
new MultiSound.Sound("doubleDate/basketballBounce", beat + 0.75f), new MultiSound.Sound("doubleDate/basketballBounce", beat + 0.75f),
}); }, forcePlay: true);
} }
public static void QueueFootBall(float beat) public static void QueueFootBall(float beat)
{ {
if (instance == null) if (GameManager.instance.currentGame != "doubleDate")
{ {
queuedBalls.Add(new QueuedBall() queuedBalls.Add(new QueuedBall()
{ {
@ -278,7 +285,7 @@ namespace HeavenStudio.Games
{ {
new MultiSound.Sound("doubleDate/footballBounce", beat), new MultiSound.Sound("doubleDate/footballBounce", beat),
new MultiSound.Sound("doubleDate/footballBounce", beat + 0.75f), new MultiSound.Sound("doubleDate/footballBounce", beat + 0.75f),
}); }, forcePlay: true);
} }
public void SpawnSoccerBall(float beat) public void SpawnSoccerBall(float beat)