mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 18:27:38 +02:00
A lot of stuff (Read desc)
Beat action is now used to define one-off objects that is used by the beat but I don't wanna bother making a different script for. Example case: the "hit 3" sprite in Karate Man. Animation helpers for functions I don't wanna rewrite 100,000 times. General improvements for Karate Man, like prepare animation and some updates to game events.
This commit is contained in:
@ -70,7 +70,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
Jukebox.PlayOneShotGame("karateman/swingNoHit");
|
||||
}
|
||||
comboIndex++;
|
||||
anim.Play("PunchLeft", 0, 0);
|
||||
AnimPlay("PunchLeft");
|
||||
}
|
||||
else if (normalizedBeat >= 1.25f && comboIndex < 2)
|
||||
{
|
||||
@ -86,7 +86,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
Jukebox.PlayOneShotGame("karateman/swingNoHit_Alt");
|
||||
}
|
||||
comboIndex++;
|
||||
anim.Play("PunchRight", 0, 0);
|
||||
AnimPlay("PunchRight");
|
||||
}
|
||||
else if (normalizedBeat >= 1.5f && comboIndex < 3)
|
||||
{
|
||||
@ -98,7 +98,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit2");
|
||||
}
|
||||
comboIndex++;
|
||||
anim.Play("ComboCrouch", 0, 0);
|
||||
AnimPlay("ComboCrouch");
|
||||
}
|
||||
else if (normalizedBeat >= 1.75f && comboIndex < 4)
|
||||
{
|
||||
@ -114,7 +114,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
Jukebox.PlayOneShotGame("karateman/comboMiss");
|
||||
}
|
||||
comboIndex++;
|
||||
anim.Play("ComboKick", 0, 0);
|
||||
AnimPlay("ComboKick");
|
||||
}
|
||||
else if (normalizedBeat >= 2f && comboIndex < 5)
|
||||
{
|
||||
@ -126,7 +126,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit3");
|
||||
}
|
||||
comboIndex++;
|
||||
anim.Play("ComboCrouchPunch", 0, 0);
|
||||
AnimPlay("ComboCrouchPunch");
|
||||
}
|
||||
else if (normalizedBeat >= 2.05f)
|
||||
{
|
||||
@ -140,7 +140,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
else
|
||||
{
|
||||
// fail anim
|
||||
anim.Play("ComboMiss");
|
||||
AnimPlay("ComboMiss");
|
||||
ResetCombo();
|
||||
}
|
||||
}
|
||||
@ -159,7 +159,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
{
|
||||
if (kickC != null) StopCoroutine(kickC);
|
||||
hitBarrel = false;
|
||||
anim.Play("Kick", 0, 0);
|
||||
AnimPlay("Kick");
|
||||
}
|
||||
|
||||
if (Conductor.instance.songPositionInBeats > barrelBeat + 3)
|
||||
@ -167,7 +167,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
if (kickC != null) StopCoroutine(kickC);
|
||||
hitBarrel = false;
|
||||
// should be inebetween for this
|
||||
anim.Play("Idle", 0, 0);
|
||||
AnimPlay("Idle");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -244,7 +244,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
barrelBeat = Conductor.instance.songPositionInBeats;
|
||||
hitBarrel = true;
|
||||
yield return new WaitForSeconds(0.17f);
|
||||
anim.Play("KickPrepare", 0, 0);
|
||||
AnimPlay("KickPrepare");
|
||||
}
|
||||
|
||||
private void Swing()
|
||||
@ -313,9 +313,9 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
Jukebox.PlayOneShotGame("karateman/swingNoHit");
|
||||
|
||||
if (punchLeft)
|
||||
anim.Play("PunchLeft", 0, 0);
|
||||
AnimPlay("PunchLeft");
|
||||
else
|
||||
anim.Play("PunchRight", 0, 0);
|
||||
AnimPlay("PunchRight");
|
||||
}
|
||||
|
||||
public void HitEffectF(Vector3 pos)
|
||||
@ -327,6 +327,12 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
Destroy(hit, 0.06f);
|
||||
}
|
||||
|
||||
public void AnimPlay(string name)
|
||||
{
|
||||
anim.Play(name, 0, 0);
|
||||
anim.speed = 1;
|
||||
}
|
||||
|
||||
private void BarrelDestroy(Pot p, bool combo)
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
|
@ -22,15 +22,20 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
public SpriteRenderer BGSprite;
|
||||
|
||||
private bool bgEnabled;
|
||||
private float newBeat, newBeatBop;
|
||||
private float newBeat;
|
||||
|
||||
private float bopLength;
|
||||
private float bopBeat;
|
||||
public GameEvent bop = new GameEvent();
|
||||
public GameEvent prepare = new GameEvent();
|
||||
|
||||
private float bgBeat;
|
||||
|
||||
public GameObject comboRef;
|
||||
|
||||
public GameObject HIT3Ref;
|
||||
|
||||
public Sprite[] Numbers;
|
||||
|
||||
|
||||
[System.Serializable]
|
||||
public class BGSpriteC
|
||||
{
|
||||
@ -122,10 +127,10 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
|
||||
MultiSound.Play(new MultiSound.Sound[]
|
||||
{
|
||||
new MultiSound.Sound("karateman/punchKick1", beat + 1f),
|
||||
new MultiSound.Sound("karateman/punchKick2", beat + 1.5f),
|
||||
new MultiSound.Sound("karateman/punchKick3", beat + 1.75f),
|
||||
new MultiSound.Sound("karateman/punchKick4", beat + 2.25f)
|
||||
new MultiSound.Sound("karateman/punchKick1", beat + 1f),
|
||||
new MultiSound.Sound("karateman/punchKick2", beat + 1.5f),
|
||||
new MultiSound.Sound("karateman/punchKick3", beat + 1.75f),
|
||||
new MultiSound.Sound("karateman/punchKick4", beat + 2.25f)
|
||||
});
|
||||
break;
|
||||
}
|
||||
@ -154,15 +159,28 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
}
|
||||
}
|
||||
|
||||
if (Conductor.instance.ReportBeat(ref newBeatBop, bopBeat % 1))
|
||||
if (Conductor.instance.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
|
||||
{
|
||||
if (Conductor.instance.songPositionInBeats >= bopBeat && Conductor.instance.songPositionInBeats < bopBeat + bopLength)
|
||||
if (Conductor.instance.songPositionInBeats >= bop.startBeat && Conductor.instance.songPositionInBeats < bop.startBeat + bop.length)
|
||||
{
|
||||
float compare = KarateJoe.anim.GetCurrentAnimatorStateInfo(0).speed;
|
||||
if (KarateJoe.anim.GetCurrentAnimatorStateInfo(0).normalizedTime >= compare && !KarateJoe.anim.IsInTransition(0))
|
||||
if (KarateJoe.anim.IsAnimationNotPlaying())
|
||||
KarateJoe.anim.Play("Bop", 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (prepare.length > 0)
|
||||
{
|
||||
if (Conductor.instance.songPositionInBeats >= prepare.startBeat && Conductor.instance.songPositionInBeats < prepare.startBeat + prepare.length)
|
||||
{
|
||||
if (KarateJoe.anim.IsAnimationNotPlaying())
|
||||
KarateJoe.AnimPlay("Prepare");
|
||||
}
|
||||
else
|
||||
{
|
||||
KarateJoe.AnimPlay("Idle");
|
||||
prepare.length = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void BGFXOn()
|
||||
@ -178,13 +196,38 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
|
||||
public void Bop(float beat, float length)
|
||||
{
|
||||
bopLength = length;
|
||||
bopBeat = beat;
|
||||
bop.length = length;
|
||||
bop.startBeat = beat;
|
||||
}
|
||||
|
||||
public void Hit3(float beat)
|
||||
{
|
||||
MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("karateman/hit", beat), new MultiSound.Sound("karateman/three", beat + 0.5f) });
|
||||
GameObject hit3 = Instantiate(HIT3Ref, this.transform);
|
||||
hit3.transform.GetChild(0).GetChild(1).GetComponent<SpriteRenderer>().sprite = Numbers[2];
|
||||
BeatAction.New(hit3, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + 0.5f, delegate { hit3.transform.GetChild(0).gameObject.SetActive(true); }),
|
||||
new BeatAction.Action(beat + 4.5f, delegate { Destroy(hit3); })
|
||||
});
|
||||
}
|
||||
|
||||
public void Hit4(float beat)
|
||||
{
|
||||
MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("karateman/hit", beat), new MultiSound.Sound("karateman/four", beat + 0.5f) });
|
||||
GameObject hit4 = Instantiate(HIT3Ref, this.transform);
|
||||
hit4.transform.GetChild(0).GetChild(1).GetComponent<SpriteRenderer>().sprite = Numbers[3];
|
||||
BeatAction.New(hit4, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + 0.5f, delegate { hit4.transform.GetChild(0).gameObject.SetActive(true); }),
|
||||
new BeatAction.Action(beat + 4.5f, delegate { Destroy(hit4); })
|
||||
});
|
||||
}
|
||||
|
||||
public void Prepare(float beat, float length)
|
||||
{
|
||||
prepare.startBeat = beat;
|
||||
prepare.length = length;
|
||||
}
|
||||
|
||||
public void CreateBomb(Transform parent, Vector2 scale, ref GameObject shadow)
|
||||
|
Reference in New Issue
Block a user