mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 18:57:40 +02:00
Double Date (#366)
* Got the inputs and audio in * Fixed some things * kick anim * more stuff * anim stuff * particle mistake oops * Oops. I am sorry * Implemented visual stuff * Made animations scaled to be faster * Fixes * lots of anims * More anims implemented --------- Co-authored-by: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Co-authored-by: minenice55 <star.elementa@gmail.com>
This commit is contained in:
@ -9,23 +9,33 @@ namespace HeavenStudio.Games.Loaders
|
||||
public static class RvlDoubleDateLoader
|
||||
{
|
||||
public static Minigame AddGame(EventCaller eventCaller) {
|
||||
return new Minigame("doubleDate", "Double Date \n<color=#eb5454>[INITIALIZATION ONLY]</color>", "ef854a", false, false, new List<GameAction>()
|
||||
return new Minigame("doubleDate", "Double Date", "ef854a", false, false, new List<GameAction>()
|
||||
{
|
||||
new GameAction("soccerBall", "Soccer Ball")
|
||||
new GameAction("bop", "Bop")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; DoubleDate.instance.ball(e.beat, e["type"]); },
|
||||
defaultLength = 2,
|
||||
function = delegate { var e = eventCaller.currentEntity; DoubleDate.instance.Bop(e.beat, e.length, e["bop"], e["autoBop"]); },
|
||||
resizable = true,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("bop", true, "Bop", "Should the two couples bop?"),
|
||||
new Param("autoBop", false, "Bop (Auto)", "Should the two couples auto bop?")
|
||||
}
|
||||
},
|
||||
new GameAction("basketball", "Basketball")
|
||||
new GameAction("soccer", "Soccer Ball")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; DoubleDate.instance.ball(e.beat, e["type"]); },
|
||||
defaultLength = 2,
|
||||
function = delegate { var e = eventCaller.currentEntity; DoubleDate.instance.SpawnSoccerBall(e.beat); },
|
||||
defaultLength = 2f,
|
||||
},
|
||||
new GameAction("basket", "Basket Ball")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; DoubleDate.instance.SpawnBasketBall(e.beat); },
|
||||
defaultLength = 2f,
|
||||
},
|
||||
new GameAction("football", "Football")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; DoubleDate.instance.ball(e.beat, e["type"]); },
|
||||
defaultLength = 2,
|
||||
}
|
||||
function = delegate { var e = eventCaller.currentEntity; DoubleDate.instance.SpawnFootBall(e.beat); },
|
||||
defaultLength = 2.5f,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -37,27 +47,126 @@ namespace HeavenStudio.Games
|
||||
|
||||
public class DoubleDate : Minigame
|
||||
{
|
||||
[Header("Prefabs")]
|
||||
[SerializeField] SoccerBall soccer;
|
||||
[SerializeField] Basketball basket;
|
||||
[SerializeField] Football football;
|
||||
[SerializeField] GameObject leaves;
|
||||
[Header("Components")]
|
||||
[SerializeField] Animator boyAnim;
|
||||
[SerializeField] Animator girlAnim;
|
||||
[SerializeField] DoubleDateWeasels weasels;
|
||||
[SerializeField] Animator treeAnim;
|
||||
[Header("Variables")]
|
||||
bool shouldBop = true;
|
||||
bool canBop = true;
|
||||
GameEvent bop = new GameEvent();
|
||||
public static DoubleDate instance;
|
||||
|
||||
[Header("Objects")]
|
||||
public Animator soccerBallAnim;
|
||||
public Animator basketballAnim;
|
||||
public Animator footballAnim;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private void HitSound(bool applause)
|
||||
void Update()
|
||||
{
|
||||
Jukebox.PlayOneShotGame("doubleDate/kick");
|
||||
if (applause) Jukebox.PlayOneShot("applause");
|
||||
var cond = Conductor.instance;
|
||||
if (cond.isPlaying && !cond.isPaused)
|
||||
{
|
||||
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop)
|
||||
{
|
||||
SingleBop();
|
||||
}
|
||||
}
|
||||
if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN))
|
||||
{
|
||||
Jukebox.PlayOneShotGame("doubleDate/kick_whiff");
|
||||
Kick(true, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void ball(float beat, int type)
|
||||
public void ToggleBop(bool go)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("doubleDate/soccerBall");
|
||||
canBop = go;
|
||||
}
|
||||
|
||||
public void Bop(float beat, float length, bool goBop, bool autoBop)
|
||||
{
|
||||
shouldBop = autoBop;
|
||||
if (goBop)
|
||||
{
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + i, delegate { SingleBop(); })
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SingleBop()
|
||||
{
|
||||
if (canBop)
|
||||
{
|
||||
boyAnim.DoScaledAnimationAsync("IdleBop", 1f);
|
||||
}
|
||||
girlAnim.DoScaledAnimationAsync("GirlBop", 1f);
|
||||
weasels.Bop();
|
||||
}
|
||||
|
||||
public void Kick(bool hit = true, bool forceNoLeaves = false, bool weaselsHappy = true)
|
||||
{
|
||||
if (hit)
|
||||
{
|
||||
boyAnim.DoScaledAnimationAsync("Kick", 1f);
|
||||
if (weaselsHappy) weasels.Happy();
|
||||
if (!forceNoLeaves)
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(Conductor.instance.songPositionInBeats + 1f, delegate
|
||||
{
|
||||
GameObject spawnedLeaves = Instantiate(leaves, transform);
|
||||
spawnedLeaves.SetActive(true);
|
||||
treeAnim.DoScaledAnimationAsync("TreeRustle", 1f);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
boyAnim.DoScaledAnimationAsync("Barely", 1f);
|
||||
}
|
||||
}
|
||||
|
||||
public void SpawnSoccerBall(float beat)
|
||||
{
|
||||
SoccerBall spawnedBall = Instantiate(soccer, instance.transform);
|
||||
spawnedBall.Init(beat);
|
||||
Jukebox.PlayOneShotGame("doubleDate/soccerBounce", beat);
|
||||
}
|
||||
|
||||
public void SpawnBasketBall(float beat)
|
||||
{
|
||||
Basketball spawnedBall = Instantiate(basket, instance.transform);
|
||||
spawnedBall.Init(beat);
|
||||
MultiSound.Play(new MultiSound.Sound[]
|
||||
{
|
||||
new MultiSound.Sound("doubleDate/basketballBounce", beat),
|
||||
new MultiSound.Sound("doubleDate/basketballBounce", beat + 0.75f),
|
||||
});
|
||||
}
|
||||
|
||||
public void SpawnFootBall(float beat)
|
||||
{
|
||||
Football spawnedBall = Instantiate(football, instance.transform);
|
||||
spawnedBall.Init(beat);
|
||||
MultiSound.Play(new MultiSound.Sound[]
|
||||
{
|
||||
new MultiSound.Sound("doubleDate/footballBounce", beat),
|
||||
new MultiSound.Sound("doubleDate/footballBounce", beat + 0.75f),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user