clappy trio to drumming practice

This commit is contained in:
Rapandrasmus 2023-11-23 13:59:59 +01:00
parent 8b3d98d25d
commit 6218dda878
5 changed files with 79 additions and 115 deletions

View file

@ -135,13 +135,14 @@ namespace HeavenStudio.Games
}
}
public override void OnBeatPulse(double beat)
{
if (shouldBop) Bop(Conductor.instance.songPositionInBeatsAsDouble);
}
void Update()
{
var cond = Conductor.instance;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (shouldBop) Bop(cond.songPositionInBeatsAsDouble);
}
if (cond.isPlaying && !cond.isPaused)
{
float normalizedBeat = cond.GetPositionFromBeat(signStartBeat, signLength);

View file

@ -165,95 +165,48 @@ namespace HeavenStudio.Games
}
}
public override void OnBeatPulse(double beat)
{
if (!goBop) return;
if (student.isHolding)
{
student.anim.DoScaledAnimationAsync("HoldBop", 0.5f);
}
else if (!student.swiping && student.anim.IsAnimationNotPlaying())
{
student.anim.DoScaledAnimationAsync("IdleBop", 0.5f);
}
var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0);
if (yellowState.IsName("Hey"))
{
//PostScratchoFace();
}
if (!andStop && !djYellowHolding)
{
float normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f);
if (normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.Happy);
else if (!djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed)) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.NeutralLeft);
djYellowScript.Reverse(djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed));
if (djYellowBopLeft)
{
djYellowAnim.DoScaledAnimationAsync("IdleBop2", 0.5f);
}
else
{
djYellowAnim.DoScaledAnimationAsync("IdleBop", 0.5f);
}
djYellowBopLeft = !djYellowBopLeft;
}
else if (djYellowHolding)
{
djYellowAnim.DoScaledAnimationAsync("HoldBop", 0.5f);
}
}
private void Update()
{
#region old script
//var cond = Conductor.instance;
//if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
//{
// if (cond.songPositionInBeatsAsDouble >= bop.startBeat && cond.songPositionInBeatsAsDouble < bop.startBeat + bop.length)
// {
// if (student.anim.IsAnimationNotPlaying())
// {
// if (student.isHolding)
// {
// student.anim.Play("HoldBop", 0, 0);
// }
// else
// {
// student.anim.Play("IdleBop", 0, 0);
// }
// }
// if (djYellowAnim.IsAnimationNotPlaying())
// {
// var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0);
// if (yellowState.IsName("Hey"))
// {
// PostScratchoFace();
// }
// if (djYellowHolding)
// {
// djYellowAnim.Play("HoldBop", 0, 0);
// }
// else
// {
// // todo: split between left and right bop based on beat
// djYellowAnim.Play("IdleBop", 0, 0);
// }
// }
// }
//}
#endregion
if (Conductor.instance.ReportBeat(ref lastReportedBeat))
{
if (goBop)
{
if (student.isHolding)
{
student.anim.DoScaledAnimationAsync("HoldBop", 0.5f);
}
else if (!student.swiping && student.anim.IsAnimationNotPlaying())
{
student.anim.DoScaledAnimationAsync("IdleBop", 0.5f);
}
var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0);
if (yellowState.IsName("Hey"))
{
//PostScratchoFace();
}
if (!andStop && !djYellowHolding)
{
float normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f);
if (normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.Happy);
else if (!djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed)) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.NeutralLeft);
djYellowScript.Reverse(djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed));
if (djYellowBopLeft)
{
djYellowAnim.DoScaledAnimationAsync("IdleBop2", 0.5f);
}
else
{
djYellowAnim.DoScaledAnimationAsync("IdleBop", 0.5f);
}
djYellowBopLeft = !djYellowBopLeft;
}
else if (djYellowHolding)
{
djYellowAnim.DoScaledAnimationAsync("HoldBop", 0.5f);
}
}
}
else if (Conductor.instance.songPositionInBeatsAsDouble < lastReportedBeat)
{
lastReportedBeat = Math.Round(Conductor.instance.songPositionInBeatsAsDouble);
}
if(PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress) && !student.isHolding) //Start hold miss
{
student.OnMissHoldForPlayerInput();

View file

@ -17,11 +17,12 @@ namespace HeavenStudio.Games.Loaders
{
new GameAction("Bop", "Bop")
{
function = delegate { DogNinja.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity["toggle"]); },
defaultLength = 0.5f,
function = delegate { DogNinja.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length, eventCaller.currentEntity["auto"], eventCaller.currentEntity["toggle"]); },
resizable = true,
parameters = new List<Param>()
{
new Param("toggle", false, "Enable Bopping", "Whether to bop to the beat or not"),
new Param("toggle", true, "Enable Bopping", "Whether to bop to the beat or not"),
new Param("auto", false, "Enable Bopping (Auto)", "Whether to bop to the beat or not automatically"),
}
},
new GameAction("Prepare", "Prepare")
@ -141,7 +142,7 @@ namespace HeavenStudio.Games
private double lastReportedBeat = 0f;
private bool birdOnScreen = false;
static bool dontBop = false;
bool dontBop = false;
private const string sfxNum = "dogNinja/";
public static DogNinja instance;
@ -213,6 +214,12 @@ namespace HeavenStudio.Games
}
}
public override void OnBeatPulse(double beat)
{
if (dontBop) return;
DogAnim.DoScaledAnimationAsync("Bop", 0.5f);
}
private void Update()
{
if (DogAnim.GetBool("needPrepare") && DogAnim.IsAnimationNotPlaying())
@ -258,17 +265,18 @@ namespace HeavenStudio.Games
}
}
private void LateUpdate()
public void Bop(double beat, float length, bool auto, bool bop)
{
if (Conductor.instance.ReportBeat(ref lastReportedBeat) && DogAnim.IsAnimationNotPlaying() && !dontBop)
{
DogAnim.DoScaledAnimationAsync("Bop", 0.5f);
}
}
dontBop = !auto;
if (!bop) return;
List<BeatAction.Action> actions = new();
public void Bop(double beat, bool bop)
{
dontBop = !bop;
for (int i = 0; i < length; i++)
{
actions.Add(new(beat + i, delegate { DogAnim.DoScaledAnimationAsync("Bop", 0.5f); }));
}
if (actions.Count > 0) BeatAction.New(this, actions);
}
public static void QueueObject(double beat, int direction, int typeL, int typeR, bool prepare, bool muteThrow)

View file

@ -138,6 +138,11 @@ namespace HeavenStudio.Games
clouds.transform.position = Vector3.left * ((Time.realtimeSinceStartup * cloudSpeed) % cloudDistance);
}
public override void OnBeatPulse(double beat)
{
if (shouldBop) SingleBop();
}
void Update()
{
var cond = Conductor.instance;
@ -162,10 +167,6 @@ namespace HeavenStudio.Games
}
queuedBalls.Clear();
}
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop)
{
SingleBop();
}
}
else
{

View file

@ -144,16 +144,17 @@ namespace HeavenStudio.Games
PersistColor(beat);
}
public override void OnBeatPulse(double beat)
{
if (goBop)
{
Bop();
}
}
private void Update()
{
var cond = Conductor.instance;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (goBop)
{
Bop();
}
}
if (isMoving && cond.isPlaying && !cond.isPaused)
{