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-04-22 19:20:01 +00:00
|
|
|
preFunction = delegate { var e = eventCaller.currentEntity; DoubleDate.QueueSoccerBall(e.beat); },
|
2023-04-22 19:39:54 +00:00
|
|
|
preFunctionLength = 1f,
|
2023-03-27 03:12:23 +00:00
|
|
|
defaultLength = 2f,
|
|
|
|
},
|
|
|
|
new GameAction("basket", "Basket Ball")
|
|
|
|
{
|
2023-04-22 19:20:01 +00:00
|
|
|
preFunction = delegate { var e = eventCaller.currentEntity; DoubleDate.QueueBasketBall(e.beat); },
|
2023-04-22 19:39:54 +00:00
|
|
|
preFunctionLength = 1f,
|
2023-03-27 03:12:23 +00:00
|
|
|
defaultLength = 2f,
|
2023-01-13 22:24:26 +00:00
|
|
|
},
|
|
|
|
new GameAction("football", "Football")
|
|
|
|
{
|
2023-04-22 19:20:01 +00:00
|
|
|
preFunction = delegate { var e = eventCaller.currentEntity; DoubleDate.QueueFootBall(e.beat); },
|
2023-04-22 19:39:54 +00:00
|
|
|
preFunctionLength = 1f,
|
2023-03-27 03:12:23 +00:00
|
|
|
defaultLength = 2.5f,
|
|
|
|
},
|
2023-05-28 17:34:44 +00:00
|
|
|
},
|
|
|
|
new List<string>() {"rvl", "normal"},
|
|
|
|
"rvldate", "en",
|
|
|
|
new List<string>() {}
|
|
|
|
);
|
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")]
|
2023-04-22 19:20:01 +00:00
|
|
|
[SerializeField] GameObject soccer;
|
|
|
|
[SerializeField] GameObject basket;
|
|
|
|
[SerializeField] GameObject football;
|
|
|
|
[SerializeField] GameObject dropShadow;
|
|
|
|
[SerializeField] ParticleSystem leaves;
|
|
|
|
|
2023-03-27 03:12:23 +00:00
|
|
|
[Header("Components")]
|
|
|
|
[SerializeField] Animator boyAnim;
|
|
|
|
[SerializeField] Animator girlAnim;
|
|
|
|
[SerializeField] DoubleDateWeasels weasels;
|
|
|
|
[SerializeField] Animator treeAnim;
|
2023-04-22 19:20:01 +00:00
|
|
|
[SerializeField] GameObject clouds;
|
|
|
|
|
2023-03-27 03:12:23 +00:00
|
|
|
[Header("Variables")]
|
2023-04-22 19:20:01 +00:00
|
|
|
[SerializeField] public float cloudSpeed;
|
|
|
|
[SerializeField] public float cloudDistance;
|
|
|
|
[SerializeField] public float floorHeight;
|
|
|
|
[SerializeField] public float shadowDepthScaleMin;
|
|
|
|
[SerializeField] public float shadowDepthScaleMax;
|
|
|
|
[SerializeField] SuperCurveObject.Path[] ballBouncePaths;
|
2023-06-10 19:13:29 +00:00
|
|
|
double lastGirlGacha = double.MinValue;
|
2023-03-27 03:12:23 +00:00
|
|
|
bool shouldBop = true;
|
|
|
|
bool canBop = true;
|
|
|
|
GameEvent bop = new GameEvent();
|
2023-01-13 22:24:26 +00:00
|
|
|
public static DoubleDate instance;
|
2023-04-22 19:20:01 +00:00
|
|
|
public static List<QueuedBall> queuedBalls = new List<QueuedBall>();
|
2023-06-10 19:13:29 +00:00
|
|
|
[NonSerialized] public double lastHitWeasel = double.MinValue;
|
2023-04-22 19:20:01 +00:00
|
|
|
|
|
|
|
public enum BallType
|
|
|
|
{
|
|
|
|
Soccer,
|
|
|
|
Basket,
|
|
|
|
Football
|
|
|
|
}
|
|
|
|
|
|
|
|
public struct QueuedBall
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
public double beat;
|
2023-04-22 19:20:01 +00:00
|
|
|
public BallType type;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Editor gizmo to draw trajectories
|
|
|
|
new void OnDrawGizmos()
|
|
|
|
{
|
|
|
|
base.OnDrawGizmos();
|
|
|
|
foreach (SuperCurveObject.Path path in ballBouncePaths)
|
|
|
|
{
|
|
|
|
if (path.preview)
|
|
|
|
{
|
|
|
|
soccer.GetComponent<SoccerBall>().DrawEditorGizmo(path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public override void OnPlay(double beat)
|
2023-04-22 19:20:01 +00:00
|
|
|
{
|
|
|
|
queuedBalls.Clear();
|
|
|
|
}
|
|
|
|
|
2023-04-22 19:39:54 +00:00
|
|
|
private void OnDestroy() {
|
|
|
|
queuedBalls.Clear();
|
2023-06-03 23:30:17 +00:00
|
|
|
foreach (var evt in scheduledInputs)
|
|
|
|
{
|
|
|
|
evt.Disable();
|
|
|
|
}
|
2023-04-22 19:39:54 +00:00
|
|
|
}
|
|
|
|
|
2023-01-13 22:24:26 +00:00
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
instance = this;
|
|
|
|
}
|
|
|
|
|
2023-04-22 19:20:01 +00:00
|
|
|
private void Start() {
|
|
|
|
clouds.transform.position = Vector3.left * ((Time.realtimeSinceStartup * cloudSpeed) % cloudDistance);
|
|
|
|
}
|
|
|
|
|
2023-03-27 03:12:23 +00:00
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
var cond = Conductor.instance;
|
|
|
|
if (cond.isPlaying && !cond.isPaused)
|
|
|
|
{
|
2023-04-22 19:20:01 +00:00
|
|
|
if (queuedBalls.Count != 0)
|
|
|
|
{
|
|
|
|
foreach (QueuedBall ball in queuedBalls)
|
|
|
|
{
|
|
|
|
switch (ball.type)
|
|
|
|
{
|
|
|
|
case BallType.Soccer:
|
|
|
|
SpawnSoccerBall(ball.beat);
|
|
|
|
break;
|
|
|
|
case BallType.Basket:
|
|
|
|
SpawnBasketBall(ball.beat);
|
|
|
|
break;
|
|
|
|
case BallType.Football:
|
|
|
|
SpawnFootBall(ball.beat);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
queuedBalls.Clear();
|
|
|
|
}
|
2023-03-27 03:12:23 +00:00
|
|
|
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop)
|
|
|
|
{
|
|
|
|
SingleBop();
|
|
|
|
}
|
|
|
|
}
|
2023-04-22 19:20:01 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((!cond.isPaused) && queuedBalls.Count != 0)
|
|
|
|
{
|
|
|
|
queuedBalls.Clear();
|
|
|
|
}
|
|
|
|
}
|
2023-03-27 03:12:23 +00:00
|
|
|
if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN))
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("doubleDate/kick_whiff");
|
2023-03-27 03:12:23 +00:00
|
|
|
Kick(true, true, false);
|
|
|
|
}
|
2023-04-22 19:20:01 +00:00
|
|
|
clouds.transform.position = Vector3.left * ((Time.realtimeSinceStartup * cloudSpeed) % cloudDistance);
|
2023-03-27 03:12:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void ToggleBop(bool go)
|
|
|
|
{
|
|
|
|
canBop = go;
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void Bop(double 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);
|
|
|
|
}
|
2023-06-10 19:13:29 +00:00
|
|
|
if (Conductor.instance.songPositionInBeatsAsDouble > lastGirlGacha)
|
2023-04-22 19:20:01 +00:00
|
|
|
girlAnim.DoScaledAnimationAsync("GirlBop", 1f);
|
2023-03-27 03:12:23 +00:00
|
|
|
weasels.Bop();
|
|
|
|
}
|
|
|
|
|
2023-04-22 19:20:01 +00:00
|
|
|
public void Kick(bool hit = true, bool forceNoLeaves = false, bool weaselsHappy = true, bool jump = false)
|
2023-03-27 03:12:23 +00:00
|
|
|
{
|
|
|
|
if (hit)
|
|
|
|
{
|
2023-04-22 19:20:01 +00:00
|
|
|
boyAnim.DoScaledAnimationAsync("Kick", 0.5f);
|
|
|
|
if (jump)
|
|
|
|
{
|
|
|
|
weasels.Jump();
|
2023-06-10 19:13:29 +00:00
|
|
|
lastGirlGacha = Conductor.instance.songPositionInBeatsAsDouble + 0.5f;
|
2023-04-22 19:20:01 +00:00
|
|
|
girlAnim.DoScaledAnimationAsync("GirlLookUp", 0.5f);
|
|
|
|
}
|
|
|
|
else if (weaselsHappy) weasels.Happy();
|
2023-03-27 03:12:23 +00:00
|
|
|
if (!forceNoLeaves)
|
|
|
|
{
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + 1f, delegate
|
2023-03-27 03:12:23 +00:00
|
|
|
{
|
2023-04-22 19:20:01 +00:00
|
|
|
leaves.Play();
|
2023-03-27 03:12:23 +00:00
|
|
|
treeAnim.DoScaledAnimationAsync("TreeRustle", 1f);
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-04-22 19:20:01 +00:00
|
|
|
boyAnim.DoScaledAnimationAsync("Barely", 0.5f);
|
|
|
|
weasels.Surprise();
|
2023-03-27 03:12:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public static void QueueSoccerBall(double beat)
|
2023-03-27 03:12:23 +00:00
|
|
|
{
|
2023-04-22 19:39:54 +00:00
|
|
|
if (GameManager.instance.currentGame != "doubleDate")
|
2023-04-22 19:20:01 +00:00
|
|
|
{
|
|
|
|
queuedBalls.Add(new QueuedBall()
|
|
|
|
{
|
|
|
|
beat = beat,
|
|
|
|
type = BallType.Soccer
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
instance.SpawnSoccerBall(beat);
|
|
|
|
}
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("doubleDate/soccerBounce", beat, forcePlay: true);
|
2023-03-27 03:12:23 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public static void QueueBasketBall(double beat)
|
2023-03-27 03:12:23 +00:00
|
|
|
{
|
2023-04-22 19:39:54 +00:00
|
|
|
if (GameManager.instance.currentGame != "doubleDate")
|
2023-04-22 19:20:01 +00:00
|
|
|
{
|
|
|
|
queuedBalls.Add(new QueuedBall()
|
|
|
|
{
|
|
|
|
beat = beat,
|
|
|
|
type = BallType.Basket
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
instance.SpawnBasketBall(beat);
|
|
|
|
}
|
2023-03-27 03:12:23 +00:00
|
|
|
MultiSound.Play(new MultiSound.Sound[]
|
|
|
|
{
|
|
|
|
new MultiSound.Sound("doubleDate/basketballBounce", beat),
|
|
|
|
new MultiSound.Sound("doubleDate/basketballBounce", beat + 0.75f),
|
2023-04-22 19:39:54 +00:00
|
|
|
}, forcePlay: true);
|
2023-03-27 03:12:23 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public static void QueueFootBall(double beat)
|
2023-03-27 03:12:23 +00:00
|
|
|
{
|
2023-04-22 19:39:54 +00:00
|
|
|
if (GameManager.instance.currentGame != "doubleDate")
|
2023-04-22 19:20:01 +00:00
|
|
|
{
|
|
|
|
queuedBalls.Add(new QueuedBall()
|
|
|
|
{
|
|
|
|
beat = beat,
|
|
|
|
type = BallType.Football
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
instance.SpawnFootBall(beat);
|
|
|
|
}
|
2023-03-27 03:12:23 +00:00
|
|
|
MultiSound.Play(new MultiSound.Sound[]
|
|
|
|
{
|
|
|
|
new MultiSound.Sound("doubleDate/footballBounce", beat),
|
|
|
|
new MultiSound.Sound("doubleDate/footballBounce", beat + 0.75f),
|
2023-04-22 19:39:54 +00:00
|
|
|
}, forcePlay: true);
|
2023-01-13 22:24:26 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void SpawnSoccerBall(double beat)
|
2023-04-22 19:20:01 +00:00
|
|
|
{
|
|
|
|
SoccerBall spawnedBall = Instantiate(soccer, instance.transform).GetComponent<SoccerBall>();
|
|
|
|
spawnedBall.Init(beat);
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void SpawnBasketBall(double beat)
|
2023-04-22 19:20:01 +00:00
|
|
|
{
|
|
|
|
Basketball spawnedBall = Instantiate(basket, instance.transform).GetComponent<Basketball>();
|
|
|
|
spawnedBall.Init(beat);
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void SpawnFootBall(double beat)
|
2023-04-22 19:20:01 +00:00
|
|
|
{
|
|
|
|
Football spawnedBall = Instantiate(football, instance.transform).GetComponent<Football>();
|
|
|
|
spawnedBall.Init(beat);
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void MissKick(double beat, bool hit = false)
|
2023-04-22 19:20:01 +00:00
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
lastGirlGacha = Conductor.instance.songPositionInBeatsAsDouble + 1.5f;
|
2023-04-22 19:20:01 +00:00
|
|
|
girlAnim.DoScaledAnimationAsync("GirlSad", 0.5f);
|
|
|
|
if (hit)
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
lastHitWeasel = Conductor.instance.songPositionInBeatsAsDouble;
|
2023-04-22 19:20:01 +00:00
|
|
|
BeatAction.New(gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat - (0.25f/3f), delegate { weasels.Hit(beat); }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
lastHitWeasel = Conductor.instance.songPositionInBeatsAsDouble;
|
2023-04-22 19:20:01 +00:00
|
|
|
BeatAction.New(gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 0.25, delegate { weasels.Hide(beat + 0.25f); }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public SuperCurveObject.Path GetPath(string name)
|
|
|
|
{
|
|
|
|
foreach (SuperCurveObject.Path path in ballBouncePaths)
|
|
|
|
{
|
|
|
|
if (path.name == name)
|
|
|
|
{
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return default(SuperCurveObject.Path);
|
|
|
|
}
|
|
|
|
|
|
|
|
public GameObject MakeDropShadow()
|
|
|
|
{
|
|
|
|
GameObject shadow = Instantiate(dropShadow, transform);
|
|
|
|
return shadow;
|
|
|
|
}
|
|
|
|
}
|
2023-01-13 22:24:26 +00:00
|
|
|
}
|