2023-01-13 22:24:26 +00:00
|
|
|
using HeavenStudio.Util;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games.Loaders
|
|
|
|
{
|
|
|
|
using static Minigames;
|
|
|
|
public static class RvlDoubleDateLoader
|
|
|
|
{
|
|
|
|
public static Minigame AddGame(EventCaller eventCaller) {
|
2023-04-02 02:28:23 +00:00
|
|
|
return new Minigame("doubleDate", "Double Date", "ef854a", false, false, new List<GameAction>()
|
2023-01-13 22:24:26 +00:00
|
|
|
{
|
2023-03-27 03:12:23 +00:00
|
|
|
new GameAction("bop", "Bop")
|
2023-01-13 22:24:26 +00:00
|
|
|
{
|
2023-03-27 03:12:23 +00:00
|
|
|
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?")
|
|
|
|
}
|
2023-01-13 22:24:26 +00:00
|
|
|
},
|
2023-03-27 03:12:23 +00:00
|
|
|
new GameAction("soccer", "Soccer Ball")
|
2023-01-13 22:24:26 +00:00
|
|
|
{
|
2023-03-27 03:12:23 +00:00
|
|
|
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,
|
2023-01-13 22:24:26 +00:00
|
|
|
},
|
|
|
|
new GameAction("football", "Football")
|
|
|
|
{
|
2023-03-27 03:12:23 +00:00
|
|
|
function = delegate { var e = eventCaller.currentEntity; DoubleDate.instance.SpawnFootBall(e.beat); },
|
|
|
|
defaultLength = 2.5f,
|
|
|
|
},
|
2023-01-13 22:24:26 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games
|
|
|
|
{
|
|
|
|
using Scripts_DoubleDate;
|
|
|
|
|
|
|
|
public class DoubleDate : Minigame
|
|
|
|
{
|
2023-03-27 03:12:23 +00:00
|
|
|
[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();
|
2023-01-13 22:24:26 +00:00
|
|
|
public static DoubleDate instance;
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
instance = this;
|
|
|
|
}
|
|
|
|
|
2023-03-27 03:12:23 +00:00
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
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 ToggleBop(bool go)
|
|
|
|
{
|
|
|
|
canBop = go;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Bop(float beat, float length, bool goBop, bool autoBop)
|
2023-01-13 22:24:26 +00:00
|
|
|
{
|
2023-03-27 03:12:23 +00:00
|
|
|
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(); })
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2023-01-13 22:24:26 +00:00
|
|
|
}
|
|
|
|
|
2023-03-27 03:12:23 +00:00
|
|
|
void SingleBop()
|
2023-01-13 22:24:26 +00:00
|
|
|
{
|
2023-03-27 03:12:23 +00:00
|
|
|
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),
|
|
|
|
});
|
2023-01-13 22:24:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|