2022-06-12 22:15:53 +00:00
|
|
|
using HeavenStudio.Util;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games.Loaders
|
|
|
|
{
|
|
|
|
using static Minigames;
|
|
|
|
public static class PcoSomenLoader
|
|
|
|
{
|
2023-01-25 03:54:19 +00:00
|
|
|
public static Minigame AddGame(EventCaller eventCaller)
|
|
|
|
{
|
2023-04-02 02:28:23 +00:00
|
|
|
return new Minigame("rhythmSomen", "Rhythm Sōmen", "7ab96e", false, false, new List<GameAction>()
|
2022-06-12 22:15:53 +00:00
|
|
|
{
|
2024-01-15 02:04:10 +00:00
|
|
|
new GameAction("bop", "Bop")
|
|
|
|
{
|
|
|
|
function = delegate { var e = eventCaller.currentEntity; RhythmSomen.instance.ToggleBop(e.beat, e.length, e["toggle2"], e["toggle"]); },
|
|
|
|
resizable = true,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("toggle2", true, "Bop", "Toggle if Boss should bop for the duration of this event."),
|
|
|
|
new Param("toggle", false, "Bop (Auto)", "Toggle if the man should automatically bop until another Bop event is reached.")
|
|
|
|
}
|
|
|
|
},
|
2022-08-21 03:13:52 +00:00
|
|
|
new GameAction("crane (far)", "Far Crane")
|
|
|
|
{
|
2023-01-25 03:54:19 +00:00
|
|
|
function = delegate { RhythmSomen.instance.DoFarCrane(eventCaller.currentEntity.beat); },
|
|
|
|
defaultLength = 4.0f,
|
2022-08-21 03:13:52 +00:00
|
|
|
},
|
|
|
|
new GameAction("crane (close)", "Close Crane")
|
|
|
|
{
|
2023-01-25 03:54:19 +00:00
|
|
|
function = delegate { RhythmSomen.instance.DoCloseCrane(eventCaller.currentEntity.beat); },
|
|
|
|
defaultLength = 3.0f,
|
2022-08-21 03:13:52 +00:00
|
|
|
},
|
|
|
|
new GameAction("crane (both)", "Both Cranes")
|
|
|
|
{
|
2023-01-25 03:54:19 +00:00
|
|
|
function = delegate { RhythmSomen.instance.DoBothCrane(eventCaller.currentEntity.beat); },
|
|
|
|
defaultLength = 4.0f,
|
2022-08-21 03:13:52 +00:00
|
|
|
},
|
|
|
|
new GameAction("offbeat bell", "Offbeat Warning")
|
|
|
|
{
|
|
|
|
function = delegate { RhythmSomen.instance.DoBell(eventCaller.currentEntity.beat); },
|
|
|
|
},
|
2023-03-20 22:20:34 +00:00
|
|
|
new GameAction("slurp", "Slurp")
|
|
|
|
{
|
|
|
|
function = delegate { RhythmSomen.instance.Slurp(eventCaller.currentEntity.beat); }
|
2023-02-21 21:56:01 +00:00
|
|
|
}
|
2023-05-28 17:34:44 +00:00
|
|
|
},
|
2023-10-29 19:44:47 +00:00
|
|
|
new List<string>() { "pco", "normal" },
|
2023-05-28 17:34:44 +00:00
|
|
|
"pcosomen", "en",
|
2024-03-29 02:35:07 +00:00
|
|
|
new List<string>() { },
|
|
|
|
chronologicalSortKey: 20130101
|
2023-05-28 17:34:44 +00:00
|
|
|
);
|
2022-06-12 22:15:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games
|
|
|
|
{
|
|
|
|
// using Scripts_RhythmSomen;
|
|
|
|
public class RhythmSomen : Minigame
|
|
|
|
{
|
2023-02-05 03:05:43 +00:00
|
|
|
[SerializeField] ParticleSystem splashEffect;
|
2022-06-12 22:15:53 +00:00
|
|
|
public Animator SomenPlayer;
|
2022-06-24 01:47:42 +00:00
|
|
|
public Animator FrontArm;
|
2023-03-20 22:20:34 +00:00
|
|
|
[SerializeField] Animator backArm;
|
2022-06-24 01:47:42 +00:00
|
|
|
public Animator EffectHit;
|
|
|
|
public Animator EffectSweat;
|
|
|
|
public Animator EffectExclam;
|
|
|
|
public Animator EffectShock;
|
2022-06-12 22:15:53 +00:00
|
|
|
public Animator CloseCrane;
|
|
|
|
public Animator FarCrane;
|
|
|
|
public GameObject Player;
|
2023-03-20 22:20:34 +00:00
|
|
|
private bool missed;
|
|
|
|
private bool hasSlurped;
|
2022-06-12 22:15:53 +00:00
|
|
|
|
|
|
|
public static RhythmSomen instance;
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Awake()
|
|
|
|
{
|
|
|
|
instance = this;
|
2023-12-05 22:38:52 +00:00
|
|
|
SetupBopRegion("rhythmSomen", "bop", "toggle");
|
2022-06-12 22:15:53 +00:00
|
|
|
}
|
|
|
|
|
2023-11-23 16:19:39 +00:00
|
|
|
public override void OnBeatPulse(double beat)
|
2022-06-12 22:15:53 +00:00
|
|
|
{
|
2023-12-05 22:38:52 +00:00
|
|
|
if (BeatIsInBopRegion(beat)) SomenPlayer.DoScaledAnimationAsync("HeadBob", 0.5f);
|
2023-11-23 16:19:39 +00:00
|
|
|
}
|
2022-06-24 01:47:42 +00:00
|
|
|
|
2023-11-23 16:19:39 +00:00
|
|
|
void Update()
|
|
|
|
{
|
2023-10-29 19:44:47 +00:00
|
|
|
if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress))
|
2022-06-24 01:47:42 +00:00
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("rhythmSomen/somen_mistake");
|
2023-11-23 16:19:39 +00:00
|
|
|
FrontArm.DoScaledAnimationAsync("ArmPluck", 0.5f);
|
|
|
|
backArm.DoScaledAnimationAsync("BackArmNothing", 0.5f);
|
2023-03-20 22:20:34 +00:00
|
|
|
hasSlurped = false;
|
2023-11-23 16:19:39 +00:00
|
|
|
EffectSweat.DoScaledAnimationAsync("BlobSweating", 0.5f);
|
2023-01-25 03:54:19 +00:00
|
|
|
ScoreMiss();
|
2022-06-24 01:47:42 +00:00
|
|
|
}
|
2022-06-12 22:15:53 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void Slurp(double beat)
|
2023-03-20 22:20:34 +00:00
|
|
|
{
|
|
|
|
if (!missed)
|
|
|
|
{
|
2023-11-23 16:19:39 +00:00
|
|
|
backArm.DoScaledAnimationAsync("BackArmLift", 0.5f);
|
2023-03-20 22:20:34 +00:00
|
|
|
FrontArm.DoScaledAnimationAsync("ArmSlurp", 0.5f);
|
|
|
|
hasSlurped = true;
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-03-20 22:20:34 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 1f, delegate
|
|
|
|
{
|
|
|
|
if (hasSlurped)
|
|
|
|
{
|
2023-11-23 16:19:39 +00:00
|
|
|
backArm.DoScaledAnimationAsync("BackArmNothing", 0.5f);
|
|
|
|
FrontArm.DoScaledAnimationAsync("ArmNothing", 0.5f);
|
2023-03-20 22:20:34 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void ToggleBop(double beat, float length, bool bopOrNah, bool autoBop)
|
2023-02-21 21:56:01 +00:00
|
|
|
{
|
2023-03-07 17:22:32 +00:00
|
|
|
if (bopOrNah)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < length; i++)
|
|
|
|
{
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-03-07 17:22:32 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + i, delegate
|
|
|
|
{
|
2023-11-23 16:19:39 +00:00
|
|
|
SomenPlayer.DoScaledAnimationAsync("HeadBob", 0.5f);
|
2023-03-07 17:22:32 +00:00
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2023-02-21 21:56:01 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void DoFarCrane(double beat)
|
2022-06-12 22:15:53 +00:00
|
|
|
{
|
|
|
|
//Far Drop Multisound
|
2023-10-29 19:44:47 +00:00
|
|
|
ScheduleInput(beat, 3f, InputAction_BasicPress, CatchSuccess, CatchMiss, CatchEmpty);
|
2022-06-12 22:15:53 +00:00
|
|
|
MultiSound.Play(new MultiSound.Sound[] {
|
|
|
|
new MultiSound.Sound("rhythmSomen/somen_lowerfar", beat),
|
|
|
|
new MultiSound.Sound("rhythmSomen/somen_drop", beat + 1f),
|
|
|
|
new MultiSound.Sound("rhythmSomen/somen_woosh", beat + 1.5f),
|
|
|
|
});
|
|
|
|
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2022-06-12 22:15:53 +00:00
|
|
|
{
|
2023-11-23 16:19:39 +00:00
|
|
|
new BeatAction.Action(beat, delegate { FarCrane.DoScaledAnimationAsync("Drop", 0.5f);}),
|
|
|
|
new BeatAction.Action(beat + 1.0f, delegate { FarCrane.DoScaledAnimationAsync("Open", 0.5f);}),
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { FarCrane.DoScaledAnimationAsync("Lift", 0.5f);}),
|
2022-06-12 22:15:53 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void DoCloseCrane(double beat)
|
2022-06-12 22:15:53 +00:00
|
|
|
{
|
|
|
|
//Close Drop Multisound
|
2023-10-29 19:44:47 +00:00
|
|
|
ScheduleInput(beat, 2f, InputAction_BasicPress, CatchSuccess, CatchMiss, CatchEmpty);
|
2022-06-12 22:15:53 +00:00
|
|
|
MultiSound.Play(new MultiSound.Sound[] {
|
|
|
|
new MultiSound.Sound("rhythmSomen/somen_lowerclose", beat),
|
|
|
|
new MultiSound.Sound("rhythmSomen/somen_drop", beat + 1f),
|
|
|
|
new MultiSound.Sound("rhythmSomen/somen_woosh", beat + 1.5f),
|
|
|
|
});
|
|
|
|
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2022-06-12 22:15:53 +00:00
|
|
|
{
|
2023-11-23 16:19:39 +00:00
|
|
|
new BeatAction.Action(beat, delegate { CloseCrane.DoScaledAnimationAsync("DropClose", 0.5f);}),
|
|
|
|
new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.DoScaledAnimationAsync("OpenClose", 0.5f);}),
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.DoScaledAnimationAsync("LiftClose", 0.5f);}),
|
2022-06-12 22:15:53 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void DoBothCrane(double beat)
|
2022-06-12 22:15:53 +00:00
|
|
|
{
|
|
|
|
//Both Drop Multisound
|
2023-10-29 19:44:47 +00:00
|
|
|
ScheduleInput(beat, 2f, InputAction_BasicPress, CatchSuccess, CatchMiss, CatchEmpty);
|
|
|
|
ScheduleInput(beat, 3f, InputAction_BasicPress, CatchSuccess, CatchMiss, CatchEmpty);
|
2022-06-12 22:15:53 +00:00
|
|
|
MultiSound.Play(new MultiSound.Sound[] {
|
2023-10-29 19:44:47 +00:00
|
|
|
new MultiSound.Sound("rhythmSomen/somen_lowerfar", beat),
|
|
|
|
new MultiSound.Sound("rhythmSomen/somen_doublealarm", beat),
|
|
|
|
new MultiSound.Sound("rhythmSomen/somen_drop", beat + 1f),
|
|
|
|
new MultiSound.Sound("rhythmSomen/somen_woosh", beat + 1.5f),
|
2022-06-12 22:15:53 +00:00
|
|
|
});
|
|
|
|
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-10-29 19:44:47 +00:00
|
|
|
{
|
2023-11-23 16:19:39 +00:00
|
|
|
new BeatAction.Action(beat, delegate { CloseCrane.DoScaledAnimationAsync("DropClose", 0.5f);}),
|
|
|
|
new BeatAction.Action(beat, delegate { FarCrane.DoScaledAnimationAsync("Drop", 0.5f);}),
|
|
|
|
new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.DoScaledAnimationAsync("OpenClose", 0.5f);}),
|
|
|
|
new BeatAction.Action(beat + 1.0f, delegate { FarCrane.DoScaledAnimationAsync("Open", 0.5f);}),
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.DoScaledAnimationAsync("LiftClose", 0.5f);}),
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { FarCrane.DoScaledAnimationAsync("Lift", 0.5f);}),
|
2023-10-29 19:44:47 +00:00
|
|
|
});
|
2022-06-12 22:15:53 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void DoBell(double beat)
|
2023-01-25 03:54:19 +00:00
|
|
|
{
|
|
|
|
//Bell Sound lol
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("rhythmSomen/somen_bell");
|
2022-06-12 22:15:53 +00:00
|
|
|
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-10-29 19:44:47 +00:00
|
|
|
{
|
2023-11-23 16:19:39 +00:00
|
|
|
new BeatAction.Action(beat, delegate { EffectExclam.DoScaledAnimationAsync("ExclamAppear", 0.5f);}),
|
2023-10-29 19:44:47 +00:00
|
|
|
});
|
2022-06-12 22:15:53 +00:00
|
|
|
|
2023-01-25 03:54:19 +00:00
|
|
|
}
|
2022-06-24 01:47:42 +00:00
|
|
|
|
2023-01-25 03:54:19 +00:00
|
|
|
public void CatchSuccess(PlayerActionEvent caller, float state)
|
|
|
|
{
|
2023-11-23 16:19:39 +00:00
|
|
|
backArm.DoScaledAnimationAsync("BackArmNothing", 0, 0);
|
2023-03-20 22:20:34 +00:00
|
|
|
hasSlurped = false;
|
2023-02-05 03:05:43 +00:00
|
|
|
splashEffect.Play();
|
|
|
|
if (state >= 1f || state <= -1f)
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("rhythmSomen/somen_splash");
|
2023-11-23 16:19:39 +00:00
|
|
|
FrontArm.DoScaledAnimationAsync("ArmPluckNG", 0.5f);
|
|
|
|
EffectSweat.DoScaledAnimationAsync("BlobSweating", 0.5f);
|
2023-03-20 22:20:34 +00:00
|
|
|
missed = true;
|
2023-02-05 03:05:43 +00:00
|
|
|
return;
|
|
|
|
}
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("rhythmSomen/somen_catch");
|
|
|
|
SoundByte.PlayOneShotGame("rhythmSomen/somen_catch_old", volume: 0.25f);
|
2023-11-23 16:19:39 +00:00
|
|
|
FrontArm.DoScaledAnimationAsync("ArmPluckOK", 0.5f);
|
|
|
|
EffectHit.DoScaledAnimationAsync("HitAppear", 0.5f);
|
2023-03-20 22:20:34 +00:00
|
|
|
missed = false;
|
2023-01-25 03:54:19 +00:00
|
|
|
}
|
2022-06-24 01:47:42 +00:00
|
|
|
|
2023-01-25 03:54:19 +00:00
|
|
|
public void CatchMiss(PlayerActionEvent caller)
|
|
|
|
{
|
2023-03-20 22:20:34 +00:00
|
|
|
missed = true;
|
2023-11-23 16:19:39 +00:00
|
|
|
EffectShock.DoScaledAnimationAsync("ShockAppear", 0.5f);
|
2023-01-25 03:54:19 +00:00
|
|
|
}
|
2022-06-24 01:47:42 +00:00
|
|
|
|
2023-01-25 03:54:19 +00:00
|
|
|
public void CatchEmpty(PlayerActionEvent caller)
|
|
|
|
{
|
2022-06-24 01:47:42 +00:00
|
|
|
|
2023-01-25 03:54:19 +00:00
|
|
|
}
|
2022-06-12 22:15:53 +00:00
|
|
|
}
|
|
|
|
}
|