Implemented functionality to "bop" + pitching sfx
pretty much does what the title says. pitching for voicelines is automatic, and scales properly to tempo (based on 98 bpm)
This commit is contained in:
parent
6718f0a6b5
commit
c663781e5a
|
|
@ -17,11 +17,15 @@ namespace HeavenStudio.Games.Loaders
|
||||||
{
|
{
|
||||||
new GameAction("bop", "Bop")
|
new GameAction("bop", "Bop")
|
||||||
{
|
{
|
||||||
function = delegate { Manzai.instance.Bop(); },
|
function = delegate {
|
||||||
|
var e = eventCaller.currentEntity;
|
||||||
|
Manzai.instance.Bop(e.beat, e.length, e["who"], e["bop"], e["auto"]);
|
||||||
|
},
|
||||||
resizable = true,
|
resizable = true,
|
||||||
parameters = new List<Param>()
|
parameters = new List<Param>()
|
||||||
{
|
{
|
||||||
new Param("who", Manzai.WhoBops.Both, "Who Bops?", "Which bird bops"),
|
new Param("who", Manzai.WhoBops.Both, "Who Bops?", "Which bird bops"),
|
||||||
|
new Param("bop", true, "Enable Bopping", "Whether to bop to the beat or not"),
|
||||||
new Param("auto", false, "Automatic?", "Whether to bop to the beat or not automatically"),
|
new Param("auto", false, "Automatic?", "Whether to bop to the beat or not automatically"),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -76,10 +80,12 @@ namespace HeavenStudio.Games
|
||||||
[SerializeField] Animator VultureAnim;
|
[SerializeField] Animator VultureAnim;
|
||||||
[SerializeField] Animator RavenAnim;
|
[SerializeField] Animator RavenAnim;
|
||||||
|
|
||||||
|
bool ravenBop = true;
|
||||||
|
bool vultureBop = true;
|
||||||
|
|
||||||
|
|
||||||
public enum WhoBops
|
public enum WhoBops
|
||||||
{
|
{
|
||||||
None,
|
|
||||||
Kasuke,
|
Kasuke,
|
||||||
Kosuke,
|
Kosuke,
|
||||||
Both,
|
Both,
|
||||||
|
|
@ -139,28 +145,64 @@ namespace HeavenStudio.Games
|
||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Bop()
|
public override void OnLateBeatPulse(double beat)
|
||||||
{
|
{
|
||||||
VultureAnim.DoScaledAnimationAsync("Bop", 0.5f);
|
if (vultureBop)
|
||||||
RavenAnim.DoScaledAnimationAsync("Bop", 0.5f);
|
VultureAnim.DoScaledAnimationAsync("Bop", 0.5f);
|
||||||
|
|
||||||
|
if (ravenBop)
|
||||||
|
RavenAnim.DoScaledAnimationAsync("Bop", 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Bop(double beat, float length, int whoBops, bool bop, bool autoBop)
|
||||||
|
{
|
||||||
|
ravenBop = (whoBops is (int)WhoBops.Kasuke or (int)WhoBops.Both) && autoBop;
|
||||||
|
vultureBop = (whoBops is (int)WhoBops.Kosuke or (int)WhoBops.Both) && autoBop;
|
||||||
|
|
||||||
|
if (bop)
|
||||||
|
{
|
||||||
|
var actions = new List<BeatAction.Action>();
|
||||||
|
for (int i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
if (whoBops is (int)WhoBops.Kasuke or (int)WhoBops.Both) actions.Add(new(beat + i, delegate { RavenAnim.DoScaledAnimationAsync("Bop", 0.5f); }));
|
||||||
|
if (whoBops is (int)WhoBops.Kosuke or (int)WhoBops.Both) actions.Add(new(beat + i, delegate { VultureAnim.DoScaledAnimationAsync("Bop", 0.5f); }));
|
||||||
|
}
|
||||||
|
BeatAction.New(this, actions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void DoPun(double beat)
|
public void DoPun(double beat)
|
||||||
{
|
{
|
||||||
SoundByte.PlayOneShotGame("manzai/"+sfxDefs[0].sfx);
|
SoundByte.PlayOneShotGame("manzai/"+sfxDefs[0].sfx, pitch: Conductor.instance.songBpm/98);
|
||||||
ScheduleInput(beat, 2.5f, InputAction_BasicPress, HaiJust, HaiMiss, Nothing);
|
ScheduleInput(beat, 2.5f, InputAction_BasicPress, HaiJust, HaiMiss, Nothing);
|
||||||
ScheduleInput(beat, 3.0f, InputAction_BasicPress, HaiJust, HaiMiss, Nothing);
|
ScheduleInput(beat, 3.0f, InputAction_BasicPress, HaiJust, HaiMiss, Nothing);
|
||||||
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
||||||
|
{
|
||||||
|
new BeatAction.Action(beat + 0.0f, delegate { VultureAnim.DoScaledAnimationAsync("Talk", 0.5f); }),
|
||||||
|
|
||||||
|
new BeatAction.Action(beat + 0.5f, delegate { VultureAnim.DoScaledAnimationAsync("Talk", 0.5f); }),
|
||||||
|
|
||||||
|
new BeatAction.Action(beat + 1.0f, delegate { VultureAnim.DoScaledAnimationAsync("Talk", 0.5f); }),
|
||||||
|
|
||||||
|
new BeatAction.Action(beat + 1.5f, delegate { VultureAnim.DoScaledAnimationAsync("Talk", 0.5f); }),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HaiJust(PlayerActionEvent caller, float state)
|
public void HaiJust(PlayerActionEvent caller, float state)
|
||||||
{
|
{
|
||||||
SoundByte.PlayOneShotGame("manzai/hai");
|
SoundByte.PlayOneShotGame("manzai/hai", pitch: Conductor.instance.songBpm/98);
|
||||||
SoundByte.PlayOneShotGame("manzai/haiAccent");
|
SoundByte.PlayOneShotGame("manzai/haiAccent");
|
||||||
RavenAnim.DoScaledAnimationAsync("Talk", 0.5f);
|
RavenAnim.DoScaledAnimationAsync("Talk", 0.5f);
|
||||||
|
VultureAnim.DoScaledAnimationAsync("Bop", 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HaiMiss(PlayerActionEvent caller)
|
public void HaiMiss(PlayerActionEvent caller)
|
||||||
{
|
{
|
||||||
SoundByte.PlayOneShotGame("manzai/hai");
|
SoundByte.PlayOneShotGame("manzai/hai");
|
||||||
RavenAnim.DoScaledAnimationAsync("Talk", 0.5f);
|
RavenAnim.DoScaledAnimationAsync("Talk", 0.5f);
|
||||||
|
VultureAnim.DoScaledAnimationAsync("Bop", 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Nothing(PlayerActionEvent caller)
|
public void Nothing(PlayerActionEvent caller)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue