Glee Club - fixes and tweaks (#348)

* Glee Club - fixes and tweaks

* New default semitones for gleeclub

* Together Now is more visually accurate
This commit is contained in:
Rapandrasmus 2023-03-15 20:11:31 +01:00 committed by GitHub
parent d98ec339dc
commit dbce2041c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 78 additions and 32 deletions

View File

@ -18,7 +18,9 @@ namespace HeavenStudio.Games.Scripts_GleeClub
public bool singing; public bool singing;
bool disappeared = false; public bool disappeared = false;
public bool shouldMegaClose;
private GleeClub game; private GleeClub game;
@ -29,7 +31,7 @@ namespace HeavenStudio.Games.Scripts_GleeClub
void OnDestroy() void OnDestroy()
{ {
Jukebox.KillLoop(currentSound, gameSwitchFadeOutTime); if (currentSound != null) Jukebox.KillLoop(currentSound, gameSwitchFadeOutTime);
} }
public void TogglePresence(bool disappear) public void TogglePresence(bool disappear)
@ -71,9 +73,19 @@ namespace HeavenStudio.Games.Scripts_GleeClub
singing = true; singing = true;
anim.SetBool("Mega", true); anim.SetBool("Mega", true);
anim.Play("OpenMouth", 0, 0); anim.Play("OpenMouth", 0, 0);
Jukebox.KillLoop(currentSound, 0f); shouldMegaClose = true;
if (currentSound != null) Jukebox.KillLoop(currentSound, 0f);
Jukebox.PlayOneShotGame("gleeClub/LoudWailStart"); Jukebox.PlayOneShotGame("gleeClub/LoudWailStart");
currentSound = Jukebox.PlayOneShotGame("gleeClub/LoudWailLoop", -1, currentPitch, 1f, true); currentSound = Jukebox.PlayOneShotGame("gleeClub/LoudWailLoop", -1, currentPitch, 1f, true);
BeatAction.New(game.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(Conductor.instance.songPositionInBeats + 1f, delegate { UnYell(); })
});
}
void UnYell()
{
if (singing && !anim.GetCurrentAnimatorStateInfo(0).IsName("YellIdle")) anim.Play("YellIdle", 0, 0);
} }
public void StartSinging(bool forced = false) public void StartSinging(bool forced = false)
@ -81,8 +93,9 @@ namespace HeavenStudio.Games.Scripts_GleeClub
if ((singing && !forced) || disappeared) return; if ((singing && !forced) || disappeared) return;
singing = true; singing = true;
anim.SetBool("Mega", false); anim.SetBool("Mega", false);
shouldMegaClose = false;
anim.Play("OpenMouth", 0, 0); anim.Play("OpenMouth", 0, 0);
Jukebox.KillLoop(currentSound, 0f); if (currentSound != null) Jukebox.KillLoop(currentSound, 0f);
currentSound = Jukebox.PlayOneShotGame("gleeClub/WailLoop", -1, currentPitch, 1f, true); currentSound = Jukebox.PlayOneShotGame("gleeClub/WailLoop", -1, currentPitch, 1f, true);
} }
@ -91,7 +104,7 @@ namespace HeavenStudio.Games.Scripts_GleeClub
if (!singing || disappeared) return; if (!singing || disappeared) return;
singing = false; singing = false;
anim.Play(mega ? "MegaCloseMouth" : "CloseMouth", 0, 0); anim.Play(mega ? "MegaCloseMouth" : "CloseMouth", 0, 0);
Jukebox.KillLoop(currentSound, 0f); if (currentSound != null) Jukebox.KillLoop(currentSound, 0f);
if (playSound) Jukebox.PlayOneShotGame("gleeClub/StopWail"); if (playSound) Jukebox.PlayOneShotGame("gleeClub/StopWail");
} }
} }

View File

@ -14,7 +14,6 @@ namespace HeavenStudio.Games.Loaders
{ {
new GameAction("intervalStart", "Start Interval") new GameAction("intervalStart", "Start Interval")
{ {
function = delegate {var e = eventCaller.currentEntity; GleeClub.instance.StartInterval(e.beat, e.length); },
defaultLength = 1f, defaultLength = 1f,
resizable = true resizable = true
}, },
@ -25,9 +24,9 @@ namespace HeavenStudio.Games.Loaders
resizable = true, resizable = true,
parameters = new List<Param>() parameters = new List<Param>()
{ {
new Param("semiTones", new EntityTypes.Integer(-24, 24, 0), "Semitones", "The number of semitones up or down this note should be pitched"), new Param("semiTones", new EntityTypes.Integer(-24, 24, -5), "Semitones", "The number of semitones up or down this note should be pitched"),
new Param("semiTones1", new EntityTypes.Integer(-24, 24, 0), "Semitones (Next)", "The number of semitones up or down this note should be pitched"), new Param("semiTones1", new EntityTypes.Integer(-24, 24, -1), "Semitones (Next)", "The number of semitones up or down this note should be pitched"),
new Param("semiTonesPlayer", new EntityTypes.Integer(-24, 24, 0), "Semitones (Player)", "The number of semitones up or down this note should be pitched"), new Param("semiTonesPlayer", new EntityTypes.Integer(-24, 24, 2), "Semitones (Player)", "The number of semitones up or down this note should be pitched"),
new Param("close", GleeClub.MouthOpenClose.Both, "Close/Open Mouth", "Should the chorus kids close/open their mouth?"), new Param("close", GleeClub.MouthOpenClose.Both, "Close/Open Mouth", "Should the chorus kids close/open their mouth?"),
new Param("repeat", false, "Repeating", "Should the left and middle chorus kid repeat this singing cue?"), new Param("repeat", false, "Repeating", "Should the left and middle chorus kid repeat this singing cue?"),
new Param("semiTonesLeft2", new EntityTypes.Integer(-24, 24, 0), "Semitones (Repeat Left First)", "The number of semitones up or down this note should be pitched"), new Param("semiTonesLeft2", new EntityTypes.Integer(-24, 24, 0), "Semitones (Repeat Left First)", "The number of semitones up or down this note should be pitched"),
@ -46,9 +45,9 @@ namespace HeavenStudio.Games.Loaders
defaultLength = 4f, defaultLength = 4f,
parameters = new List<Param>() parameters = new List<Param>()
{ {
new Param("semiTones", new EntityTypes.Integer(-24, 24, 0), "Semitones", "The number of semitones up or down this note should be pitched"), new Param("semiTones", new EntityTypes.Integer(-24, 24, -1), "Semitones", "The number of semitones up or down this note should be pitched"),
new Param("semiTones1", new EntityTypes.Integer(-24, 24, 0), "Semitones (Next)", "The number of semitones up or down this note should be pitched"), new Param("semiTones1", new EntityTypes.Integer(-24, 24, 4), "Semitones (Next)", "The number of semitones up or down this note should be pitched"),
new Param("semiTonesPlayer", new EntityTypes.Integer(-24, 24, 0), "Semitones (Player)", "The number of semitones up or down this note should be pitched"), new Param("semiTonesPlayer", new EntityTypes.Integer(-24, 24, 10), "Semitones (Player)", "The number of semitones up or down this note should be pitched"),
new Param("pitch", new EntityTypes.Float(0f, 5f, 1f), "Conductor Voice Pitch", "Which pitch should the conductor's voice be at? (1 is normal pitch)") new Param("pitch", new EntityTypes.Float(0f, 5f, 1f), "Conductor Voice Pitch", "Which pitch should the conductor's voice be at? (1 is normal pitch)")
} }
}, },
@ -138,9 +137,24 @@ namespace HeavenStudio.Games
public static GleeClub instance; public static GleeClub instance;
float currentYellPitch = 1f; float currentYellPitch = 1f;
int startIntervalIndex;
private List<DynamicBeatmap.DynamicEntity> allIntervalEvents = new List<DynamicBeatmap.DynamicEntity>();
void Awake() void Awake()
{ {
instance = this; instance = this;
var camEvents = EventCaller.GetAllInGameManagerList("gleeClub", new string[] { "intervalStart" });
List<DynamicBeatmap.DynamicEntity> tempEvents = new List<DynamicBeatmap.DynamicEntity>();
for (int i = 0; i < camEvents.Count; i++)
{
if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeats)
{
tempEvents.Add(camEvents[i]);
}
}
allIntervalEvents = tempEvents;
} }
void Start() void Start()
@ -163,6 +177,8 @@ namespace HeavenStudio.Games
} }
void Update() void Update()
{
if (!playerChorusKid.disappeared)
{ {
if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN)) if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN))
{ {
@ -178,6 +194,8 @@ namespace HeavenStudio.Games
middleChorusKid.MissPose(); middleChorusKid.MissPose();
ScoreMiss(); ScoreMiss();
} }
}
if (Conductor.instance.isPlaying && !Conductor.instance.isPaused) if (Conductor.instance.isPlaying && !Conductor.instance.isPaused)
{ {
if (queuedBatons.Count > 0) if (queuedBatons.Count > 0)
@ -193,6 +211,18 @@ namespace HeavenStudio.Games
{ {
PassTurn(intervalStartBeat + beatInterval, 0f); PassTurn(intervalStartBeat + beatInterval, 0f);
} }
if (allIntervalEvents.Count > 0)
{
if (startIntervalIndex < allIntervalEvents.Count && startIntervalIndex >= 0)
{
if (Conductor.instance.songPositionInBeats >= allIntervalEvents[startIntervalIndex].beat)
{
StartInterval(allIntervalEvents[startIntervalIndex].beat, allIntervalEvents[startIntervalIndex].length);
startIntervalIndex++;
}
}
}
} }
if (!Conductor.instance.isPlaying || Conductor.instance.isPaused) if (!Conductor.instance.isPlaying || Conductor.instance.isPaused)
@ -229,8 +259,8 @@ namespace HeavenStudio.Games
public void TogetherNow(float beat, int semiTones, int semiTones1, int semiTonesPlayer, float conductorPitch) public void TogetherNow(float beat, int semiTones, int semiTones1, int semiTonesPlayer, float conductorPitch)
{ {
ScheduleInput(beat, 2.5f, InputType.STANDARD_UP, JustTogetherNow, Out, Out); if (!playerChorusKid.disappeared) ScheduleInput(beat, 2.5f, InputType.STANDARD_UP, JustTogetherNow, Out, Out);
ScheduleInput(beat, 3.5f, InputType.STANDARD_DOWN, JustTogetherNowClose, MissBaton, Out); if (!playerChorusKid.disappeared) ScheduleInput(beat, 3.5f, InputType.STANDARD_DOWN, JustTogetherNowClose, MissBaton, Out);
float pitch = Mathf.Pow(2f, (1f / 12f) * semiTones) * Conductor.instance.musicSource.pitch; float pitch = Mathf.Pow(2f, (1f / 12f) * semiTones) * Conductor.instance.musicSource.pitch;
float pitch1 = Mathf.Pow(2f, (1f / 12f) * semiTones1) * Conductor.instance.musicSource.pitch; float pitch1 = Mathf.Pow(2f, (1f / 12f) * semiTones1) * Conductor.instance.musicSource.pitch;
currentYellPitch = Mathf.Pow(2f, (1f / 12f) * semiTonesPlayer) * Conductor.instance.musicSource.pitch; currentYellPitch = Mathf.Pow(2f, (1f / 12f) * semiTonesPlayer) * Conductor.instance.musicSource.pitch;
@ -264,7 +294,7 @@ namespace HeavenStudio.Games
}), }),
new BeatAction.Action(beat + 6f, delegate new BeatAction.Action(beat + 6f, delegate
{ {
ShowHeart(beat + 6f); if (!playerChorusKid.disappeared) ShowHeart(beat + 6f);
}) })
}); });
} }
@ -318,13 +348,16 @@ namespace HeavenStudio.Games
if (queuedSingings.Count == 0) return; if (queuedSingings.Count == 0) return;
intervalStarted = false; intervalStarted = false;
missed = false; missed = false;
ShowHeart(beat + length + beatInterval * 2 + 1); if (!playerChorusKid.disappeared) ShowHeart(beat + length + beatInterval * 2 + 1);
foreach (var sing in queuedSingings) foreach (var sing in queuedSingings)
{ {
float playerPitch = Mathf.Pow(2f, (1f / 12f) * sing.semiTonesPlayer) * Conductor.instance.musicSource.pitch; float playerPitch = Mathf.Pow(2f, (1f / 12f) * sing.semiTonesPlayer) * Conductor.instance.musicSource.pitch;
if (!playerChorusKid.disappeared)
{
GleeClubSingInput spawnedInput = Instantiate(singInputPrefab, transform); GleeClubSingInput spawnedInput = Instantiate(singInputPrefab, transform);
spawnedInput.pitch = playerPitch; spawnedInput.pitch = playerPitch;
spawnedInput.Init(beat + length + sing.startBeat + beatInterval, sing.length, sing.closeMouth); spawnedInput.Init(beat + length + sing.startBeat + beatInterval, sing.length, sing.closeMouth);
}
float pitch = Mathf.Pow(2f, (1f / 12f) * sing.semiTones) * Conductor.instance.musicSource.pitch; float pitch = Mathf.Pow(2f, (1f / 12f) * sing.semiTones) * Conductor.instance.musicSource.pitch;
float pitchLeft2 = Mathf.Pow(2f, (1f / 12f) * sing.semiTonesLeft2) * Conductor.instance.musicSource.pitch; float pitchLeft2 = Mathf.Pow(2f, (1f / 12f) * sing.semiTonesLeft2) * Conductor.instance.musicSource.pitch;
float pitchLeft3 = Mathf.Pow(2f, (1f / 12f) * sing.semiTonesLeft3) * Conductor.instance.musicSource.pitch; float pitchLeft3 = Mathf.Pow(2f, (1f / 12f) * sing.semiTonesLeft3) * Conductor.instance.musicSource.pitch;
@ -395,7 +428,7 @@ namespace HeavenStudio.Games
public void Baton(float beat) public void Baton(float beat)
{ {
missed = false; missed = false;
ScheduleInput(beat, 1, InputType.STANDARD_DOWN, JustBaton, MissBaton, Out); if (!playerChorusKid.disappeared) ScheduleInput(beat, 1, InputType.STANDARD_DOWN, JustBaton, MissBaton, Out);
BeatAction.New(instance.gameObject, new List<BeatAction.Action>() BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{ {
new BeatAction.Action(beat, delegate new BeatAction.Action(beat, delegate