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
|
|
|
{
|
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
|
|
|
new GameAction("bop", "Bop")
|
|
|
|
{
|
2023-03-07 17:22:32 +00:00
|
|
|
function = delegate { var e = eventCaller.currentEntity; RhythmSomen.instance.ToggleBop(e.beat, e.length, e["toggle2"], e["toggle"]); },
|
|
|
|
resizable = true,
|
2023-02-21 21:56:01 +00:00
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
2023-03-07 17:22:32 +00:00
|
|
|
new Param("toggle2", true, "Bop", "Should the somen man bop?"),
|
|
|
|
new Param("toggle", false, "Bop (Auto)", "Should the somen man bop automatically?")
|
2023-02-21 21:56:01 +00:00
|
|
|
}
|
|
|
|
}
|
2023-05-28 17:34:44 +00:00
|
|
|
},
|
|
|
|
new List<string>() {"pco", "normal"},
|
|
|
|
"pcosomen", "en",
|
|
|
|
new List<string>() {}
|
|
|
|
);
|
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-02-21 21:56:01 +00:00
|
|
|
private bool shouldBop = true;
|
2023-03-20 22:20:34 +00:00
|
|
|
private bool missed;
|
|
|
|
private bool hasSlurped;
|
2022-06-12 22:15:53 +00:00
|
|
|
|
|
|
|
public GameEvent bop = new GameEvent();
|
|
|
|
|
|
|
|
public static RhythmSomen instance;
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Awake()
|
|
|
|
{
|
|
|
|
instance = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
var cond = Conductor.instance;
|
2023-02-21 21:56:01 +00:00
|
|
|
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop)
|
2022-06-12 22:15:53 +00:00
|
|
|
{
|
2023-01-25 03:54:19 +00:00
|
|
|
SomenPlayer.Play("HeadBob", -1, 0);
|
2022-06-12 22:15:53 +00:00
|
|
|
}
|
2022-06-24 01:47:42 +00:00
|
|
|
|
|
|
|
if (PlayerInput.Pressed() && !IsExpectingInputNow())
|
|
|
|
{
|
2023-06-10 19:17:06 +00:00
|
|
|
SoundByte.PlayOneShotGame("rhythmSomen/somen_mistake");
|
2023-01-25 03:54:19 +00:00
|
|
|
FrontArm.Play("ArmPluck", -1, 0);
|
2023-03-20 22:20:34 +00:00
|
|
|
backArm.Play("BackArmNothing", 0, 0);
|
|
|
|
hasSlurped = false;
|
2023-01-25 03:54:19 +00:00
|
|
|
EffectSweat.Play("BlobSweating", -1, 0);
|
|
|
|
ScoreMiss();
|
2022-06-24 01:47:42 +00:00
|
|
|
}
|
2022-06-12 22:15:53 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void Slurp(double beat)
|
2023-03-20 22:20:34 +00:00
|
|
|
{
|
|
|
|
if (!missed)
|
|
|
|
{
|
|
|
|
backArm.Play("BackArmLift", 0, 0);
|
|
|
|
FrontArm.DoScaledAnimationAsync("ArmSlurp", 0.5f);
|
|
|
|
hasSlurped = true;
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 1f, delegate
|
|
|
|
{
|
|
|
|
if (hasSlurped)
|
|
|
|
{
|
|
|
|
backArm.Play("BackArmNothing", 0, 0);
|
|
|
|
FrontArm.Play("ArmNothing", 0, 0);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +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
|
|
|
shouldBop = autoBop;
|
|
|
|
if (bopOrNah)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < length; i++)
|
|
|
|
{
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + i, delegate
|
|
|
|
{
|
|
|
|
SomenPlayer.Play("HeadBob", -1, 0);
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2023-02-21 21:56:01 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void DoFarCrane(double beat)
|
2022-06-12 22:15:53 +00:00
|
|
|
{
|
|
|
|
//Far Drop Multisound
|
2022-06-24 01:47:42 +00:00
|
|
|
ScheduleInput(beat, 3f, InputType.STANDARD_DOWN, 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-01-25 03:54:19 +00:00
|
|
|
BeatAction.New(Player, new List<BeatAction.Action>()
|
2022-06-12 22:15:53 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat, delegate { FarCrane.Play("Drop", -1, 0);}),
|
|
|
|
new BeatAction.Action(beat + 1.0f, delegate { FarCrane.Play("Open", -1, 0);}),
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { FarCrane.Play("Lift", -1, 0);}),
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void DoCloseCrane(double beat)
|
2022-06-12 22:15:53 +00:00
|
|
|
{
|
|
|
|
//Close Drop Multisound
|
2022-06-24 01:47:42 +00:00
|
|
|
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, 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-01-25 03:54:19 +00:00
|
|
|
BeatAction.New(Player, new List<BeatAction.Action>()
|
2022-06-12 22:15:53 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat, delegate { CloseCrane.Play("DropClose", -1, 0);}),
|
|
|
|
new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.Play("OpenClose", -1, 0);}),
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.Play("LiftClose", -1, 0);}),
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void DoBothCrane(double beat)
|
2022-06-12 22:15:53 +00:00
|
|
|
{
|
|
|
|
//Both Drop Multisound
|
2022-06-24 01:47:42 +00:00
|
|
|
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, CatchSuccess, CatchMiss, CatchEmpty);
|
|
|
|
ScheduleInput(beat, 3f, InputType.STANDARD_DOWN, 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_doublealarm", beat),
|
|
|
|
new MultiSound.Sound("rhythmSomen/somen_drop", beat + 1f),
|
|
|
|
new MultiSound.Sound("rhythmSomen/somen_woosh", beat + 1.5f),
|
|
|
|
});
|
|
|
|
|
2023-01-25 03:54:19 +00:00
|
|
|
BeatAction.New(Player, new List<BeatAction.Action>()
|
2022-06-12 22:15:53 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat, delegate { CloseCrane.Play("DropClose", -1, 0);}),
|
|
|
|
new BeatAction.Action(beat, delegate { FarCrane.Play("Drop", -1, 0);}),
|
|
|
|
new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.Play("OpenClose", -1, 0);}),
|
|
|
|
new BeatAction.Action(beat + 1.0f, delegate { FarCrane.Play("Open", -1, 0);}),
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.Play("LiftClose", -1, 0);}),
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { FarCrane.Play("Lift", -1, 0);}),
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void DoBell(double beat)
|
2023-01-25 03:54:19 +00:00
|
|
|
{
|
|
|
|
//Bell Sound lol
|
2023-06-10 19:17:06 +00:00
|
|
|
SoundByte.PlayOneShotGame("rhythmSomen/somen_bell");
|
2022-06-12 22:15:53 +00:00
|
|
|
|
2023-01-25 03:54:19 +00:00
|
|
|
BeatAction.New(Player, new List<BeatAction.Action>()
|
2022-06-12 22:15:53 +00:00
|
|
|
{
|
2022-06-24 01:47:42 +00:00
|
|
|
new BeatAction.Action(beat, delegate { EffectExclam.Play("ExclamAppear", -1, 0);}),
|
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-03-20 22:20:34 +00:00
|
|
|
backArm.Play("BackArmNothing", 0, 0);
|
|
|
|
hasSlurped = false;
|
2023-02-05 03:05:43 +00:00
|
|
|
splashEffect.Play();
|
|
|
|
if (state >= 1f || state <= -1f)
|
|
|
|
{
|
2023-06-10 19:17:06 +00:00
|
|
|
SoundByte.PlayOneShotGame("rhythmSomen/somen_splash");
|
2023-02-05 03:05:43 +00:00
|
|
|
FrontArm.Play("ArmPluckNG", -1, 0);
|
|
|
|
EffectSweat.Play("BlobSweating", -1, 0);
|
2023-03-20 22:20:34 +00:00
|
|
|
missed = true;
|
2023-02-05 03:05:43 +00:00
|
|
|
return;
|
|
|
|
}
|
2023-06-10 19:17:06 +00:00
|
|
|
SoundByte.PlayOneShotGame("rhythmSomen/somen_catch");
|
|
|
|
SoundByte.PlayOneShotGame("rhythmSomen/somen_catch_old", volume: 0.25f);
|
2023-02-05 03:05:43 +00:00
|
|
|
FrontArm.Play("ArmPluckOK", -1, 0);
|
2022-06-24 01:47:42 +00:00
|
|
|
EffectHit.Play("HitAppear", -1, 0);
|
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;
|
2022-06-24 01:47:42 +00:00
|
|
|
EffectShock.Play("ShockAppear", -1, 0);
|
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
|
|
|
}
|
|
|
|
}
|