mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 10:27:37 +02:00
kicks complete, start work on particles
- bg colour can now be changed
This commit is contained in:
@ -17,7 +17,9 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
public GameObject Shadow;
|
||||
public GameObject ShadowInstance;
|
||||
|
||||
//hit effects
|
||||
public GameObject HitMark;
|
||||
public ParticleSystem[] HitParticles;
|
||||
|
||||
public string awakeAnim;
|
||||
FlyStatus status = FlyStatus.Fly;
|
||||
@ -143,6 +145,13 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
path = 1;
|
||||
comboId = -1;
|
||||
break;
|
||||
case ItemType.KickBomb:
|
||||
KarateMan.instance.ScheduleInput(startBeat, 0.75f, InputType.STANDARD_UP | InputType.DIRECTION_UP, KickJustOrNg, KickThrough, KickOut);
|
||||
CurrentCurve = ItemCurves[6];
|
||||
curveTargetBeat = 2 * 0.75f;
|
||||
path = 1;
|
||||
comboId = -1;
|
||||
break;
|
||||
default:
|
||||
KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ItemJustOrNg, ItemThrough, ItemOut);
|
||||
KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ItemWrongAction, ItemOut, ItemOut);
|
||||
@ -152,7 +161,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
}
|
||||
|
||||
float floorHeight = HitPosition[0].position.y;
|
||||
transform.position = ProgressToFlyPosition();
|
||||
if (CurrentCurve == null)
|
||||
transform.position = ProgressToFlyPosition();
|
||||
else
|
||||
transform.position = CurrentCurve.GetPoint(0f);
|
||||
|
||||
Animator mobjAnim = GetComponent<Animator>();
|
||||
mobjAnim.Play(awakeAnim, -1, 0);
|
||||
@ -171,19 +183,30 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
{
|
||||
case FlyStatus.Fly:
|
||||
float prog = cond.GetPositionFromBeat(startBeat, 2f);
|
||||
transform.position = ProgressToFlyPosition();
|
||||
if (CurrentCurve == null)
|
||||
transform.position = ProgressToFlyPosition();
|
||||
else
|
||||
{
|
||||
prog = cond.GetPositionFromBeat(startBeat, curveTargetBeat);
|
||||
transform.position = CurrentCurve.GetPoint(Mathf.Min(prog, 1f));
|
||||
}
|
||||
|
||||
if (prog >= 2f) {
|
||||
GameObject.Destroy(ShadowInstance.gameObject);
|
||||
GameObject.Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
else if (prog < 1f - ItemSlipRt[path]) {
|
||||
else if (CurrentCurve == null && prog < 1f - ItemSlipRt[path]) {
|
||||
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (125f * Time.deltaTime * (1/cond.pitchedSecPerBeat)));
|
||||
}
|
||||
else if (CurrentCurve != null && prog < 1f)
|
||||
{
|
||||
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (-90f * Time.deltaTime * (1/cond.pitchedSecPerBeat)));
|
||||
}
|
||||
break;
|
||||
case FlyStatus.Hit:
|
||||
prog = cond.GetPositionFromBeat(startBeat, curveTargetBeat);
|
||||
if (cond.songPositionInBeats >= startBeat + 2f || CurrentCurve == null) {
|
||||
if (cond.songPositionInBeats >= startBeat + Mathf.Max(2f, curveTargetBeat) || CurrentCurve == null) {
|
||||
GameObject.Destroy(ShadowInstance.gameObject);
|
||||
GameObject.Destroy(gameObject);
|
||||
return;
|
||||
@ -201,10 +224,24 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
}
|
||||
break;
|
||||
case FlyStatus.NG:
|
||||
//TEMPORARY
|
||||
GameObject.Destroy(ShadowInstance.gameObject);
|
||||
GameObject.Destroy(gameObject);
|
||||
return;
|
||||
prog = cond.GetPositionFromBeat(startBeat, curveTargetBeat);
|
||||
if (cond.songPositionInBeats >= startBeat + Mathf.Max(2f, curveTargetBeat) || CurrentCurve == null) {
|
||||
GameObject.Destroy(ShadowInstance.gameObject);
|
||||
GameObject.Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (prog <= 1f)
|
||||
{
|
||||
transform.position = CurrentCurve.GetPoint(prog);
|
||||
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (-90f * Time.deltaTime * (1/cond.pitchedSecPerBeat)));
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.position = CurrentCurve.GetPoint(1f);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FlyStatus.HitWeak:
|
||||
break;
|
||||
}
|
||||
@ -225,7 +262,6 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
//handles hitsound and particles
|
||||
void ItemHitEffect(bool straight = false)
|
||||
{
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
CreateHitMark(type == ItemType.KickBomb);
|
||||
switch (type)
|
||||
{
|
||||
@ -243,54 +279,84 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
CurrentCurve = ItemCurves[1];
|
||||
curveTargetBeat = 2f;
|
||||
Jukebox.PlayOneShotGame("karateman/soccerHit", forcePlay: true);
|
||||
ParticleSystem p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.Cooking:
|
||||
CurrentCurve = ItemCurves[1];
|
||||
curveTargetBeat = 2f;
|
||||
Jukebox.PlayOneShotGame("karateman/cookingPot", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
//todo: pot lid
|
||||
break;
|
||||
case ItemType.Alien:
|
||||
CurrentCurve = ItemCurves[1];
|
||||
curveTargetBeat = 2f;
|
||||
Jukebox.PlayOneShotGame("karateman/alienHit", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.TacoBell:
|
||||
CurrentCurve = ItemCurves[1];
|
||||
curveTargetBeat = 2f;
|
||||
Jukebox.PlayOneShotGame("karateman/rockHit", forcePlay: true);
|
||||
Jukebox.PlayOneShotGame("karateman/tacobell", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.ComboPot1:
|
||||
CurrentCurve = ItemCurves[straight ? 1 : 0];
|
||||
curveTargetBeat = 2f;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.ComboPot2:
|
||||
CurrentCurve = ItemCurves[0];
|
||||
curveTargetBeat = 2f;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.ComboPot3:
|
||||
CurrentCurve = ItemCurves[2];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit2", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[2].position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.ComboPot4:
|
||||
CurrentCurve = ItemCurves[3];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit3", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[3].position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.ComboPot5:
|
||||
CurrentCurve = ItemCurves[4];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit3", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[4].position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.ComboBarrel:
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit4", forcePlay: true);
|
||||
p = Instantiate(HitParticles[0], HitPosition[5].position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
p = Instantiate(HitParticles[1], HitPosition[5].position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.KickBarrel:
|
||||
KarateMan.instance.CreateItemInstance(startBeat + 1f, "Item04", ItemType.KickBomb);
|
||||
Jukebox.PlayOneShotGame("karateman/barrelBreak", forcePlay: true);
|
||||
p = Instantiate(HitParticles[0], HitPosition[1].position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.KickBomb:
|
||||
Jukebox.PlayOneShotGame("karateman/bombKick", forcePlay: true);
|
||||
break;
|
||||
default:
|
||||
CurrentCurve = ItemCurves[straight ? 1 : 0];
|
||||
@ -299,6 +365,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
break;
|
||||
}
|
||||
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
status = FlyStatus.Hit;
|
||||
}
|
||||
|
||||
@ -376,6 +443,9 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
if (status == FlyStatus.Fly && !joe.inCombo) {
|
||||
bool straight = joe.Punch(ItemPunchHand());
|
||||
if (state <= -1f || state >= 1f) {
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
CurrentCurve = ItemCurves[6];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
status = FlyStatus.NG;
|
||||
}
|
||||
@ -395,6 +465,9 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
if (status == FlyStatus.Fly && !joe.inCombo) {
|
||||
joe.ForceFailCombo(Conductor.instance.songPositionInBeats);
|
||||
if (state <= -1f || state >= 1f) {
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
CurrentCurve = ItemCurves[6];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
status = FlyStatus.NG;
|
||||
}
|
||||
@ -429,6 +502,9 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
joe.SetComboId(comboId);
|
||||
joe.SetShouldComboId(comboId);
|
||||
if (state <= -1f || state >= 1f) {
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
CurrentCurve = ItemCurves[6];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
status = FlyStatus.NG;
|
||||
}
|
||||
@ -453,6 +529,9 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
if (status == FlyStatus.Fly && !joe.inCombo) {
|
||||
bool straight = joe.Punch(ItemPunchHand());
|
||||
if (state <= -1f || state >= 1f) {
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
CurrentCurve = ItemCurves[6];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
status = FlyStatus.NG;
|
||||
}
|
||||
@ -472,6 +551,9 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
joe.SetShouldComboId(-1);
|
||||
joe.ComboSequence(3);
|
||||
if (state <= -1f || state >= 1f) {
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
CurrentCurve = ItemCurves[5];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
status = FlyStatus.NG;
|
||||
}
|
||||
@ -518,11 +600,13 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
if (status == FlyStatus.Fly && !(joe.inKick || joe.wantKick || joe.inCombo)) {
|
||||
joe.Punch(ItemPunchHand());
|
||||
if (state <= -1f || state >= 1f) {
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
CurrentCurve = ItemCurves[6];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
status = FlyStatus.NG;
|
||||
}
|
||||
else {
|
||||
//spawn the bomb
|
||||
joe.StartKickCharge(startBeat + 1.25f);
|
||||
ItemHitEffect();
|
||||
status = FlyStatus.Hit;
|
||||
@ -544,5 +628,43 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
public void KickJustOrNg(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
var joe = KarateMan.instance.Joe;
|
||||
if (status == FlyStatus.Fly && joe.inKick) {
|
||||
joe.Kick(Conductor.instance.songPositionInBeats);
|
||||
if (state <= -1f || state >= 1f) {
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
CurrentCurve = ItemCurves[8];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
status = FlyStatus.NG;
|
||||
}
|
||||
else {
|
||||
ItemHitEffect();
|
||||
status = FlyStatus.Hit;
|
||||
CurrentCurve = ItemCurves[7];
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
curveTargetBeat = 3f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void KickOut(PlayerActionEvent caller) {}
|
||||
|
||||
public void KickThrough(PlayerActionEvent caller)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
if (status != FlyStatus.Fly || gameObject == null) return;
|
||||
BeatAction.New(gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(startBeat + 2f, delegate {
|
||||
//TODO: play miss sound
|
||||
//deduct flow if applicable
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user