mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-14 13:45:10 +00:00
3a4279ce5e
* Air Rally Text Update * Blue Bear Text Update * Board Meeting Text Update * Built To Scale DS Text Update also changed Air Rally's assetbundle tag from "normal" to "keep" * Catchy Tune Text Update also changed some minor wording in Board Meeting and Built To Scale DS * Cheer Readers Text Update * The Clappy Trio Text Update * Coin Toss Text Update * Crop Stomp Text Update * DJ School Text Update * Dog Ninja Text Update * Double Date Text Update * Drumming Practice Text Update * Fan Club Text Update * Fireworks Text Update * Second Contact Text Update * Flipper-Flop Text Update also fix an error in Catchy Tune * Fork Lifter Text Update * Glee Club Text Update * Karate Man Text Update also minor updates to other games * Kitties! Text Update * Launch Party Text Update * Lockstep Text Update * Marching Orders Text Update * Meat Grinder Text Update also fixed an error in Second Contact * Mr. Upbeat Text Update * Munchy Monk Text Update * Octopus Machine Text Update * Pajama Party Text Update * Quiz Show Text Update also changed some wording in meat grinder * Rhythm Rally Text Update * Rhythm Somen Text Update that was easy * Rhythm Tweezers Text Update * Ringside Text Update * Rockers Text Update this sucked * Samurai Slice DS Text Update * See Saw Text Update * Sneaky Spirits Text Update * Spaceball Text Update * Space Dance Text Update * Space Soccer Text Update * Splashdown Text Update * Tambourine Text Update * Tap Trial Text Update * Tap Troupe Text Update * The Dazzles Text Update * Toss Boys Text Update * Tram & Pauline Text Update also added translation for Fireworks * Tunnel Text Update * Wizard's Waltz Text Update * Working Dough Text Update * fix compiler errors * fix editor offset bug(?) * fix missing param in second contact * Ball Redispense text * remove space soccer swing * Trick on the Class Text Update * Non-Game Text Update * fix pre-function sorting * camera shake ease * remove a bunch of prints * rhythm tweezers bug fix * Update Credits.txt * ssds nop samurai bop * swap order of shake properties * Update FirstContact.cs --------- Co-authored-by: minenice55 <star.elementa@gmail.com>
444 lines
18 KiB
C#
444 lines
18 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using HeavenStudio.Util;
|
|
using HeavenStudio.InputSystem;
|
|
using System;
|
|
|
|
namespace HeavenStudio.Games.Loaders
|
|
{
|
|
using static Minigames;
|
|
|
|
public static class NtrSplashdownLoader
|
|
{
|
|
public static Minigame AddGame(EventCaller eventCaller)
|
|
{
|
|
return new Minigame("splashdown", "Splashdown", "327BF5", false, false, new List<GameAction>()
|
|
{
|
|
new GameAction("dive", "Dive")
|
|
{
|
|
function = delegate { var e = eventCaller.currentEntity; Splashdown.instance.GoDown(e.beat, e.length); },
|
|
resizable = true
|
|
},
|
|
new GameAction("appear", "Appear")
|
|
{
|
|
function = delegate { var e = eventCaller.currentEntity; Splashdown.instance.GoUp(e.beat, e.length, e["type"]); },
|
|
resizable = true,
|
|
parameters = new List<Param>()
|
|
{
|
|
new Param("type", new EntityTypes.Integer(1, 3, 1), "Type", "Set the type of animation to play when surfacing.")
|
|
}
|
|
},
|
|
new GameAction("jump", "Jump")
|
|
{
|
|
function = delegate { var e = eventCaller.currentEntity; Splashdown.instance.Jump(e.beat, e.length, e["dolphin"]); },
|
|
defaultLength = 2f,
|
|
resizable = true,
|
|
parameters = new List<Param>()
|
|
{
|
|
new Param("dolphin", true, "Dolphin", "Toggle if the dolphin should be used.")
|
|
}
|
|
},
|
|
new GameAction("together", "Together Jump")
|
|
{
|
|
function = delegate { var e = eventCaller.currentEntity; Splashdown.instance.TogetherJump(e.beat, e["al"]); },
|
|
defaultLength = 4f,
|
|
parameters = new List<Param>()
|
|
{
|
|
new Param("al", false, "Alley-Oop!", "Toggle if the \"Alley-Oop!\" sound effect and animation should be used.")
|
|
}
|
|
},
|
|
new GameAction("togetherR9", "Together Jump (Remix 9)")
|
|
{
|
|
function = delegate { var e = eventCaller.currentEntity; Splashdown.instance.TogetherJumpRemix9(e.beat, e["al"]); },
|
|
defaultLength = 3f,
|
|
parameters = new List<Param>()
|
|
{
|
|
new Param("al", false, "Alley-Oop!", "Toggle if the \"Alley-Oop!\" sound effect and animation should be used.")
|
|
}
|
|
},
|
|
new GameAction("intro", "Intro")
|
|
{
|
|
function = delegate { var e = eventCaller.currentEntity; Splashdown.instance.Intro(e.beat, e.length); },
|
|
resizable = true,
|
|
defaultLength = 8
|
|
},
|
|
new GameAction("amount", "Change Synchrette Number")
|
|
{
|
|
function = delegate { Splashdown.instance.SpawnSynchrettes(eventCaller.currentEntity["amount"], eventCaller.currentEntity.beat); },
|
|
defaultLength = 0.5f,
|
|
parameters = new List<Param>()
|
|
{
|
|
new Param("amount", new EntityTypes.Integer(3, 5, 3), "Synchrettes", "Set how many synchrettes there will be. The player is always the rightmost synchrette.")
|
|
}
|
|
}
|
|
},
|
|
new List<string>() { "ntr", "normal" },
|
|
"ntrdiving", "en",
|
|
new List<string>() { "en" }
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
namespace HeavenStudio.Games
|
|
{
|
|
using Scripts_Splashdown;
|
|
|
|
public class Splashdown : Minigame
|
|
{
|
|
public static Splashdown instance;
|
|
[Header("References")]
|
|
[SerializeField] private Transform synchretteHolder;
|
|
[SerializeField] private NtrSynchrette synchrettePrefab;
|
|
[SerializeField] private Animator crowdAnim;
|
|
[Header("Properties")]
|
|
[SerializeField] private float synchretteDistance;
|
|
|
|
private List<NtrSynchrette> currentSynchrettes = new List<NtrSynchrette>();
|
|
private NtrSynchrette player;
|
|
private double _gameSwitchBeat = -1;
|
|
|
|
private void Awake()
|
|
{
|
|
instance = this;
|
|
SpawnSynchrettes(3);
|
|
}
|
|
|
|
public override void OnGameSwitch(double beat)
|
|
{
|
|
_gameSwitchBeat = beat;
|
|
}
|
|
|
|
public override void OnPlay(double beat)
|
|
{
|
|
var events = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame" }).FindAll(x => x.beat < beat);
|
|
if (events.Count == 0) return;
|
|
_gameSwitchBeat = events[^1].beat;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
var cond = Conductor.instance;
|
|
|
|
if (cond.isPlaying && !cond.isPaused && !IsIntroing())
|
|
{
|
|
if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress))
|
|
{
|
|
SoundByte.PlayOneShot("miss");
|
|
SoundByte.PlayOneShotGame("splashdown/downPlayer");
|
|
player.GoDown();
|
|
ScoreMiss();
|
|
}
|
|
|
|
if ((PlayerInput.GetIsAction(InputAction_BasicRelease) && !IsExpectingInputNow(InputAction_BasicRelease))
|
|
|| (PlayerInput.GetIsAction(InputAction_FlickRelease) && !IsExpectingInputNow(InputAction_FlickRelease)))
|
|
{
|
|
SoundByte.PlayOneShot("miss");
|
|
player.Appear(true);
|
|
SoundByte.PlayOneShotGame("splashdown/upPlayer");
|
|
ScoreMiss();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void SpawnSynchrettes(int amount, double beat = -1)
|
|
{
|
|
if (currentSynchrettes.Count > 0)
|
|
{
|
|
foreach (var synchrette in currentSynchrettes)
|
|
{
|
|
Destroy(synchrette.gameObject);
|
|
}
|
|
currentSynchrettes.Clear();
|
|
}
|
|
if (player != null) Destroy(player.gameObject);
|
|
float startPos = -((amount / 2) * synchretteDistance) + ((amount % 2 == 0) ? synchretteDistance / 2 : 0);
|
|
bool shouldGoDown = false;
|
|
if (beat >= 0)
|
|
{
|
|
var inputEvents = EventCaller.GetAllInGameManagerList("splashdown", new string[] { "dive", "appear", "jump", "together", "togetherR9" }).FindAll(x => x.beat < beat && x.beat >= _gameSwitchBeat);
|
|
if (inputEvents.Count > 0) shouldGoDown = inputEvents[^1].datamodel == "splashdown/dive";
|
|
}
|
|
for (int i = 0; i < amount; i++)
|
|
{
|
|
NtrSynchrette spawnedSynchrette = Instantiate(synchrettePrefab, synchretteHolder);
|
|
spawnedSynchrette.transform.localPosition = new Vector3(startPos + (synchretteDistance * i), spawnedSynchrette.transform.localPosition.y, 0);
|
|
if (i < amount - 1) currentSynchrettes.Add(spawnedSynchrette);
|
|
else player = spawnedSynchrette;
|
|
|
|
if (shouldGoDown) spawnedSynchrette.GoDown(false);
|
|
}
|
|
}
|
|
|
|
private double introBeat = -1;
|
|
private float introLength = 0;
|
|
|
|
private bool IsIntroing()
|
|
{
|
|
float normalized = Conductor.instance.GetPositionFromBeat(introBeat, introLength);
|
|
return normalized >= 0f && normalized <= 1f;
|
|
}
|
|
|
|
public void Intro(double beat, float length)
|
|
{
|
|
introBeat = beat;
|
|
introLength = length;
|
|
List<BeatAction.Action> actions = new List<BeatAction.Action>();
|
|
for (int i = 0; i < length - 1; i++)
|
|
{
|
|
actions.Add(new BeatAction.Action(beat + i, delegate
|
|
{
|
|
foreach (var synchrette in currentSynchrettes)
|
|
{
|
|
synchrette.Bop();
|
|
}
|
|
player.Bop();
|
|
}));
|
|
}
|
|
actions.Add(new BeatAction.Action(beat + length - 1, delegate
|
|
{
|
|
foreach (var synchrette in currentSynchrettes)
|
|
{
|
|
synchrette.JumpIntoWater(beat + length - 1);
|
|
}
|
|
player.JumpIntoWater(beat + length - 1);
|
|
}));
|
|
SoundByte.PlayOneShotGame("splashdown/start", beat + length - 0.25);
|
|
BeatAction.New(instance, actions);
|
|
}
|
|
|
|
public void GoDown(double beat, float length)
|
|
{
|
|
if (IsIntroing()) return;
|
|
List<BeatAction.Action> actions = new List<BeatAction.Action>();
|
|
for (int i = 0; i < currentSynchrettes.Count; i++)
|
|
{
|
|
NtrSynchrette synchretteToDive = currentSynchrettes[i];
|
|
double diveBeat = beat + (i * length);
|
|
actions.Add(new BeatAction.Action(diveBeat, delegate
|
|
{
|
|
synchretteToDive.GoDown();
|
|
}));
|
|
SoundByte.PlayOneShotGame("splashdown/whistle", diveBeat);
|
|
SoundByte.PlayOneShotGame("splashdown/downOthers", diveBeat);
|
|
}
|
|
BeatAction.New(instance, actions);
|
|
SoundByte.PlayOneShotGame("splashdown/whistle", beat + (currentSynchrettes.Count * length));
|
|
ScheduleInput(beat, currentSynchrettes.Count * length, InputAction_BasicPress, JustDown, Out, Out);
|
|
}
|
|
|
|
public void GoUp(double beat, float length, int appearType)
|
|
{
|
|
if (IsIntroing()) return;
|
|
List<BeatAction.Action> actions = new List<BeatAction.Action>();
|
|
for (int i = 0; i < currentSynchrettes.Count; i++)
|
|
{
|
|
NtrSynchrette synchretteToDive = currentSynchrettes[i];
|
|
double diveBeat = beat + (i * length);
|
|
actions.Add(new BeatAction.Action(diveBeat, delegate
|
|
{
|
|
synchretteToDive.Appear(false, appearType);
|
|
}));
|
|
SoundByte.PlayOneShotGame("splashdown/whistle", diveBeat);
|
|
SoundByte.PlayOneShotGame("splashdown/upOthers", diveBeat);
|
|
}
|
|
BeatAction.New(instance, actions);
|
|
SoundByte.PlayOneShotGame("splashdown/whistle", beat + (currentSynchrettes.Count * length));
|
|
switch (appearType)
|
|
{
|
|
case 1:
|
|
ScheduleInput(beat, currentSynchrettes.Count * length, InputAction_BasicRelease, JustUp1, Out, Out);
|
|
break;
|
|
case 2:
|
|
ScheduleInput(beat, currentSynchrettes.Count * length, InputAction_BasicRelease, JustUp2, Out, Out);
|
|
break;
|
|
case 3:
|
|
ScheduleInput(beat, currentSynchrettes.Count * length, InputAction_BasicRelease, JustUp3, Out, Out);
|
|
break;
|
|
}
|
|
}
|
|
|
|
public void Jump(double beat, float length, bool dolphin)
|
|
{
|
|
if (IsIntroing()) return;
|
|
List<BeatAction.Action> actions = new List<BeatAction.Action>();
|
|
for (int i = 0; i < currentSynchrettes.Count; i++)
|
|
{
|
|
NtrSynchrette synchretteToDive = currentSynchrettes[i];
|
|
double diveBeat = beat + (i * length);
|
|
actions.Add(new BeatAction.Action(diveBeat, delegate
|
|
{
|
|
synchretteToDive.Jump(diveBeat, false, !dolphin);
|
|
}));
|
|
SoundByte.PlayOneShotGame("splashdown/yeah", diveBeat);
|
|
SoundByte.PlayOneShotGame("splashdown/jumpOthers", diveBeat);
|
|
if (dolphin) SoundByte.PlayOneShotGame("splashdown/rollOthers", diveBeat + 1);
|
|
SoundByte.PlayOneShotGame("splashdown/splashOthers", diveBeat + 1.75);
|
|
}
|
|
BeatAction.New(instance, actions);
|
|
SoundByte.PlayOneShotGame("splashdown/yeah", beat + (currentSynchrettes.Count * length));
|
|
ScheduleInput(beat, currentSynchrettes.Count * length, InputAction_FlickRelease, dolphin ? JustJump : JustJumpNoRollSound, Out, Out);
|
|
}
|
|
|
|
public void TogetherJump(double beat, bool alleyoop)
|
|
{
|
|
if (IsIntroing()) return;
|
|
SoundByte.PlayOneShotGame("splashdown/together");
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(beat + 2, delegate
|
|
{
|
|
foreach (var synchrette in currentSynchrettes)
|
|
{
|
|
synchrette.Jump(beat + 2, false, alleyoop);
|
|
}
|
|
})
|
|
});
|
|
if (alleyoop)
|
|
{
|
|
MultiSound.Play(new MultiSound.Sound[]
|
|
{
|
|
new MultiSound.Sound("splashdown/jumpOthers", beat + 2),
|
|
new MultiSound.Sound("splashdown/alleyOop1", beat + 2.5, 1, 1, false, 0.014),
|
|
new MultiSound.Sound("splashdown/alleyOop2", beat + 2.75),
|
|
new MultiSound.Sound("splashdown/alleyOop3", beat + 3, 1, 1, false, 0.014),
|
|
new MultiSound.Sound("splashdown/splashOthers", beat + 3.75),
|
|
});
|
|
}
|
|
else
|
|
{
|
|
MultiSound.Play(new MultiSound.Sound[]
|
|
{
|
|
new MultiSound.Sound("splashdown/jumpOthers", beat + 2),
|
|
new MultiSound.Sound("splashdown/rollOthers", beat + 3),
|
|
new MultiSound.Sound("splashdown/splashOthers", beat + 3.75),
|
|
});
|
|
}
|
|
ScheduleInput(beat, 2, InputAction_FlickRelease, alleyoop ? JustJumpNoRollSound : JustJump, Out, Out);
|
|
}
|
|
|
|
public void TogetherJumpRemix9(double beat, bool alleyoop)
|
|
{
|
|
if (IsIntroing()) return;
|
|
SoundByte.PlayOneShotGame("splashdown/togetherRemix9");
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(beat + 1, delegate
|
|
{
|
|
foreach (var synchrette in currentSynchrettes)
|
|
{
|
|
synchrette.Jump(beat + 1, false, alleyoop);
|
|
}
|
|
})
|
|
});
|
|
if (alleyoop)
|
|
{
|
|
MultiSound.Play(new MultiSound.Sound[]
|
|
{
|
|
new MultiSound.Sound("splashdown/jumpOthers", beat + 1),
|
|
new MultiSound.Sound("splashdown/alleyOop1", beat + 1.5, 1, 1, false, 0.014),
|
|
new MultiSound.Sound("splashdown/alleyOop2", beat + 1.75),
|
|
new MultiSound.Sound("splashdown/alleyOop3", beat + 2, 1, 1, false, 0.014),
|
|
new MultiSound.Sound("splashdown/splashOthers", beat + 2.75),
|
|
});
|
|
}
|
|
else
|
|
{
|
|
MultiSound.Play(new MultiSound.Sound[]
|
|
{
|
|
new MultiSound.Sound("splashdown/jumpOthers", beat + 1),
|
|
new MultiSound.Sound("splashdown/rollOthers", beat + 2),
|
|
new MultiSound.Sound("splashdown/splashOthers", beat + 2.75),
|
|
});
|
|
}
|
|
ScheduleInput(beat, 1, InputAction_FlickRelease, alleyoop ? JustJumpNoRollSound : JustJump, Out, Out);
|
|
}
|
|
|
|
private void JustDown(PlayerActionEvent caller, float state)
|
|
{
|
|
SoundByte.PlayOneShotGame("splashdown/downPlayer");
|
|
player.GoDown();
|
|
if (state >= 1f || state <= -1f)
|
|
{
|
|
SoundByte.PlayOneShot("miss");
|
|
}
|
|
}
|
|
|
|
private void JustUp1(PlayerActionEvent caller, float state)
|
|
{
|
|
SoundByte.PlayOneShotGame("splashdown/upPlayer");
|
|
if (state >= 1f || state <= -1f)
|
|
{
|
|
SoundByte.PlayOneShot("miss");
|
|
player.Appear(true);
|
|
return;
|
|
}
|
|
player.Appear(false, 1);
|
|
}
|
|
|
|
private void JustUp2(PlayerActionEvent caller, float state)
|
|
{
|
|
SoundByte.PlayOneShotGame("splashdown/upPlayer");
|
|
if (state >= 1f || state <= -1f)
|
|
{
|
|
SoundByte.PlayOneShot("miss");
|
|
player.Appear(true);
|
|
return;
|
|
}
|
|
player.Appear(false, 2);
|
|
}
|
|
|
|
private void JustUp3(PlayerActionEvent caller, float state)
|
|
{
|
|
SoundByte.PlayOneShotGame("splashdown/upPlayer");
|
|
if (state >= 1f || state <= -1f)
|
|
{
|
|
SoundByte.PlayOneShot("miss");
|
|
player.Appear(true);
|
|
return;
|
|
}
|
|
player.Appear(false, 3);
|
|
}
|
|
|
|
private void JustJump(PlayerActionEvent caller, float state)
|
|
{
|
|
double diveBeat = caller.timer + caller.startBeat;
|
|
SoundByte.PlayOneShotGame("splashdown/jumpPlayer");
|
|
SoundByte.PlayOneShotGame("splashdown/splashPlayer", diveBeat + 1.75);
|
|
if (state >= 1f || state <= -1f)
|
|
{
|
|
player.Jump(diveBeat, true);
|
|
return;
|
|
}
|
|
SoundByte.PlayOneShotGame("splashdown/rollPlayer", diveBeat + 1);
|
|
player.Jump(diveBeat);
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(diveBeat + 1.75, delegate { crowdAnim.DoScaledAnimationAsync("CrowdCheer", 0.5f); }),
|
|
new BeatAction.Action(diveBeat + 4, delegate { crowdAnim.Play("CrowdIdle", 0, 0); })
|
|
});
|
|
}
|
|
|
|
private void JustJumpNoRollSound(PlayerActionEvent caller, float state)
|
|
{
|
|
double diveBeat = caller.timer + caller.startBeat;
|
|
SoundByte.PlayOneShotGame("splashdown/jumpPlayer");
|
|
SoundByte.PlayOneShotGame("splashdown/splashPlayer", diveBeat + 1.75);
|
|
if (state >= 1f || state <= -1f)
|
|
{
|
|
player.Jump(diveBeat, true, true);
|
|
return;
|
|
}
|
|
player.Jump(diveBeat, false, true);
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(diveBeat + 1.75, delegate { crowdAnim.DoScaledAnimationAsync("CrowdCheer", 0.5f); }),
|
|
new BeatAction.Action(diveBeat + 4, delegate { crowdAnim.Play("CrowdIdle", 0, 0); })
|
|
});
|
|
}
|
|
|
|
private void Out(PlayerActionEvent caller) { }
|
|
}
|
|
}
|
|
|