fully functional combo, several object types

This commit is contained in:
minenice55
2022-07-29 12:18:17 -04:00
parent e5cb58ce9a
commit a583529087
26 changed files with 23422 additions and 723 deletions

View File

@ -15,6 +15,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
float lastPunchTime = Single.MinValue;
float lastComboMissTime = Single.MinValue;
float lastUpperCutTime = Single.MinValue;
public bool inCombo = false;
int inComboId = -1;
int shouldComboId = -1;
@ -38,20 +39,19 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (inCombo && shouldComboId == -2)
{
float missProg = cond.GetPositionFromBeat(lastComboMissTime, 3.25f);
float missProg = cond.GetPositionFromBeat(lastComboMissTime, 3f);
if (missProg >= 0f && missProg < 1f)
{
anim.DoScaledAnimation("LowKickMiss", lastComboMissTime, 3.25f);
anim.DoScaledAnimation("LowKickMiss", lastComboMissTime, 3f);
}
else if (missProg >= 1f)
{
anim.speed = 1f;
bop.startBeat = lastComboMissTime + 3.25f;
bop.startBeat = lastComboMissTime + 3f;
lastComboMissTime = Single.MinValue;
inCombo = false;
inComboId = -1;
shouldComboId = -1;
Debug.Log("Getup");
}
}
@ -68,22 +68,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (!KarateManNew.instance.IsExpectingInputNow())
{
//start a forced-fail combo sequence
float beat = cond.songPositionInBeats;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { Punch(1); inCombo = true; inComboId = -1; shouldComboId = -1;}),
new BeatAction.Action(beat + 0.25f, delegate { Punch(2); }),
new BeatAction.Action(beat + 0.5f, delegate { ComboSequence(0); }),
new BeatAction.Action(beat + 0.75f, delegate { shouldComboId = -2; ComboMiss(beat + 0.75f); }),
});
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("karateman/swingNoHit", beat),
new MultiSound.Sound("karateman/swingNoHit_Alt", beat + 0.25f),
new MultiSound.Sound("karateman/swingNoHit_Alt", beat + 0.5f),
new MultiSound.Sound("karateman/comboMiss", beat + 0.75f),
}, forcePlay: true);
ForceFailCombo(cond.songPositionInBeats);
}
}
else if (PlayerInput.AltPressedUp())
@ -132,6 +117,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
public void ComboSequence(int seq)
{
var cond = Conductor.instance;
bop.startBeat = cond.songPositionInBeats + 1f;
switch (seq)
{
case 0:
@ -141,19 +127,51 @@ namespace HeavenStudio.Games.Scripts_KarateMan
anim.Play("LowKick", -1, 0);
break;
case 2:
anim.Play("BackHand", -1, 0);
anim.DoScaledAnimationAsync("BackHand", 0.5f);
break;
case 3:
anim.DoScaledAnimationAsync("UpperCut", 0.5f);
break;
case 4:
anim.Play("ToReady", -1, 0);
bop.startBeat = cond.songPositionInBeats + 0.5f;
break;
default:
break;
}
bop.startBeat = cond.songPositionInBeats + 1f;
}
public void ComboMiss(float beat)
{
var cond = Conductor.instance;
lastComboMissTime = beat;
bop.startBeat = beat + 3.25f;
bop.startBeat = beat + 3f;
}
public void ComboEnd(float beat, bool miss = false)
{
var cond = Conductor.instance;
bop.startBeat = cond.songPositionInBeats + 1f;
}
public void ForceFailCombo(float beat)
{
if (inCombo) return;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { Punch(1); inCombo = true; inComboId = -1; shouldComboId = -1;}),
new BeatAction.Action(beat + 0.25f, delegate { Punch(2); }),
new BeatAction.Action(beat + 0.5f, delegate { ComboSequence(0); }),
new BeatAction.Action(beat + 0.75f, delegate { shouldComboId = -2; ComboMiss(beat + 0.75f); }),
});
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("karateman/swingNoHit", beat),
new MultiSound.Sound("karateman/swingNoHit_Alt", beat + 0.25f),
new MultiSound.Sound("karateman/swingNoHit_Alt", beat + 0.5f),
new MultiSound.Sound("karateman/comboMiss", beat + 0.75f),
}, forcePlay: true);
}
}
}

View File

@ -20,7 +20,7 @@ namespace HeavenStudio.Games.Loaders
{
new Param("type", KarateManNew.HitType.Pot, "Object", "The object to fire")
}),
new GameAction("bulb", delegate {}, 2, false,
new GameAction("bulb", delegate { var e = eventCaller.currentEntity; KarateManNew.instance.CreateBulbSpecial(e.beat, e.type, e.colorA); }, 2, false,
new List<Param>()
{
new Param("type", KarateManNew.LightBulbType.Normal, "Type", "The preset bulb type. Yellow is used for kicks while Blue is used for combos"),
@ -28,12 +28,37 @@ namespace HeavenStudio.Games.Loaders
}),
new GameAction("kick", delegate { }, 4.5f),
new GameAction("combo", delegate { var e = eventCaller.currentEntity; KarateManNew.instance.Combo(e.beat); }, 4f),
new GameAction("hit3", delegate { }, 1f, false,
new GameAction("hitX", delegate { }, 1f, false,
new List<Param>()
{
new Param("type", KarateManNew.HitThree.HitThree, "Type", "What should be called out")
}),
new GameAction("prepare", delegate { }, 1f, true),
new GameAction("set background effects", delegate {
}, 0.5f, false, new List<Param>()
{
new Param("type", KarateMan.BackgroundType.Yellow, "Background Type", "The preset background type"),
new Param("type2", KarateMan.ShadowType.Tinted, "Shadow Type", "The shadow type. If Tinted doesn't work with your background color try Custom"),
new Param("colorA", new Color(), "Custom Background Color", "The background color to use when background type is set to Custom"),
new Param("colorB", new Color(), "Custom Shadow Color", "The shadow color to use when shadow type is set to Custom"),
new Param("type3", KarateMan.BackgroundFXType.None, "FX Type", "The background effect to be displayed")
}),
// These are still here for backwards-compatibility but are hidden in the editor
new GameAction("pot", delegate { }, 2, hidden: true),
new GameAction("rock", delegate { }, 2, hidden: true),
new GameAction("ball", delegate { }, 2, hidden: true),
new GameAction("tacobell", delegate { }, 2, hidden: true),
new GameAction("hit4", delegate { }, hidden: true),
new GameAction("bgfxon", delegate { }, hidden: true),
new GameAction("bgfxoff", delegate { }, hidden: true),
new GameAction("hit3", delegate { }, 1f, false,
new List<Param>()
{
new Param("type", KarateManNew.HitThree.HitThree, "Type", "What should be called out")
},
hidden: true),
new GameAction("set background color", delegate { }, 0.5f, false,
new List<Param>()
{
@ -43,20 +68,12 @@ namespace HeavenStudio.Games.Loaders
new Param("colorB", new Color(), "Custom Shadow Color", "The shadow color to use when shadow type is set to Custom"),
}),
new GameAction("set background fx", delegate { }, 0.5f, false,
new List<Param>()
{
new Param("type", KarateManNew.BackgroundFXType.None, "FX Type", "The background effect to be displayed")
}),
// These are still here for backwards-compatibility but are hidden in the editor
new GameAction("pot", delegate { }, 2, hidden: true),
new GameAction("rock", delegate { }, 2, hidden: true),
new GameAction("ball", delegate { }, 2, hidden: true),
new GameAction("tacobell", delegate { }, 2, hidden: true),
new GameAction("hit4", delegate { }, hidden: true),
new GameAction("bgfxon", delegate { }, hidden: true),
new GameAction("bgfxoff", delegate { }, hidden: true),
new GameAction("set background fx", delegate {
}, 0.5f, false, new List<Param>()
{
new Param("type", KarateMan.BackgroundFXType.None, "FX Type", "The background effect to be displayed")
},
hidden: true)
});
}
@ -78,7 +95,6 @@ namespace HeavenStudio.Games
Ball = 3,
CookingPot = 6,
Alien = 7,
TacoBell = 999
}
@ -87,7 +103,10 @@ namespace HeavenStudio.Games
HitTwo,
HitThree,
HitThreeAlt,
HitFour
HitFour,
Grr,
Warning,
HitOne,
}
public enum LightBulbType
@ -158,27 +177,60 @@ namespace HeavenStudio.Games
{
string outSound;
if (Starpelly.Mathp.GetDecimalFromFloat(beat) == 0f)
outSound = "karateman/objectOut";
else
outSound = "karateman/offbeatObjectOut";
switch (type)
{
case (int) HitType.Pot:
if (Starpelly.Mathp.GetDecimalFromFloat(beat) == 0f)
outSound = "karateman/objectOut";
else
outSound = "karateman/offbeatObjectOut";
CreateItemInstance(beat, "Item00");
break;
default:
case (int) HitType.Lightbulb:
if (Starpelly.Mathp.GetDecimalFromFloat(beat) == 0f)
outSound = "karateman/objectOut";
outSound = "karateman/lightbulbOut";
else
outSound = "karateman/offbeatObjectOut";
outSound = "karateman/offbeatLightbulbOut";
CreateItemInstance(beat, "Item01", KarateManPotNew.ItemType.Bulb);
break;
case (int) HitType.Rock:
CreateItemInstance(beat, "Item02", KarateManPotNew.ItemType.Rock);
break;
case (int) HitType.Ball:
CreateItemInstance(beat, "Item03", KarateManPotNew.ItemType.Ball);
break;
case (int) HitType.CookingPot:
CreateItemInstance(beat, "Item06", KarateManPotNew.ItemType.Cooking);
break;
case (int) HitType.Alien:
CreateItemInstance(beat, "Item07", KarateManPotNew.ItemType.Alien);
break;
case (int) HitType.TacoBell:
CreateItemInstance(beat, "Item99", KarateManPotNew.ItemType.TacoBell);
break;
default:
CreateItemInstance(beat, "Item00");
break;
}
Jukebox.PlayOneShotGame(outSound, forcePlay: true);
}
public void CreateBulbSpecial(float beat, int type, Color c)
{
string outSound;
if (Starpelly.Mathp.GetDecimalFromFloat(beat) == 0f)
outSound = "karateman/lightbulbOut";
else
outSound = "karateman/offbeatLightbulbOut";
var mobj = CreateItemInstance(beat, "Item01", KarateManPotNew.ItemType.Bulb);
if (type == (int) LightBulbType.Custom)
mobj.GetComponent<KarateManPotNew>().SetBulbColor(c);
else
mobj.GetComponent<KarateManPotNew>().SetBulbColor(LightBulbColors[type]);
Jukebox.PlayOneShotGame(outSound, forcePlay: true);
}
public void Combo(float beat)
{
Jukebox.PlayOneShotGame("karateman/barrelOutCombos", forcePlay: true);

View File

@ -17,6 +17,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
public string awakeAnim;
FlyStatus status = FlyStatus.Fly;
Color effectTint = Color.white;
public int comboId = -1;
static int _lastCombo = -1;
@ -57,6 +58,13 @@ namespace HeavenStudio.Games.Scripts_KarateMan
public Vector3[] StartPositionOffset;
public float[] ItemSlipRt;
public SpriteRenderer BulbLight;
public void SetBulbColor(Color c) {
effectTint = c;
BulbLight.color = c;
}
float ProgressToHitPosition(float progress) {
return progress + (HitPositionOffset[path] - 0.5f);
}
@ -94,6 +102,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{
case ItemType.ComboPot1:
KarateManNew.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ComboStartJustOrNg, ComboStartThrough, ComboStartOut);
KarateManNew.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ComboStartWrongAction, ComboStartOut, ComboStartOut);
path = 1;
break;
case ItemType.ComboPot2:
@ -114,12 +123,16 @@ namespace HeavenStudio.Games.Scripts_KarateMan
BeatAction.New(gameObject, new List<BeatAction.Action>() { new BeatAction.Action(startBeat + 1f, delegate { JoeComboSequence(); }) });
break;
case ItemType.ComboBarrel:
KarateManNew.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_ALT_UP, ComboEndJustOrNg, ComboEndThrough, ComboEndOut);
path = 5;
//check for button release
KarateManNew.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_ALT_UP, ComboEndJustOrNg, ComboEndThrough, ComboEndOut);
//button presses
KarateManNew.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ComboEndWrongAction, ItemOut, ItemOut);
KarateManNew.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ComboEndWrongActionAlt, ItemOut, ItemOut);
path = 5;
break;
default:
KarateManNew.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ItemJustOrNg, ItemThrough, ItemOut);
KarateManNew.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ItemWrongAction, ItemOut, ItemOut);
path = 1;
comboId = -1;
break;
@ -171,6 +184,75 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}
}
//handles hitsound and particles
void ItemHitEffect()
{
switch (type)
{
case ItemType.Bulb:
Jukebox.PlayOneShotGame("karateman/lightbulbHit", forcePlay: true);
break;
case ItemType.Rock:
Jukebox.PlayOneShotGame("karateman/rockHit", forcePlay: true);
break;
case ItemType.Ball:
Jukebox.PlayOneShotGame("karateman/soccerHit", forcePlay: true);
break;
case ItemType.Cooking:
Jukebox.PlayOneShotGame("karateman/cookingPot", forcePlay: true);
break;
case ItemType.Alien:
Jukebox.PlayOneShotGame("karateman/alienHit", forcePlay: true);
break;
case ItemType.TacoBell:
Jukebox.PlayOneShotGame("karateman/rockHit", forcePlay: true);
Jukebox.PlayOneShotGame("karateman/tacobell", forcePlay: true);
break;
case ItemType.ComboPot1:
Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
break;
case ItemType.ComboPot2:
Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
break;
case ItemType.ComboPot3:
Jukebox.PlayOneShotGame("karateman/comboHit2", forcePlay: true);
break;
case ItemType.ComboPot4:
Jukebox.PlayOneShotGame("karateman/comboHit3", forcePlay: true);
break;
case ItemType.ComboPot5:
Jukebox.PlayOneShotGame("karateman/comboHit3", forcePlay: true);
break;
case ItemType.ComboBarrel:
Jukebox.PlayOneShotGame("karateman/comboHit4", forcePlay: true);
break;
default:
Jukebox.PlayOneShotGame("karateman/potHit", forcePlay: true);
break;
}
status = FlyStatus.Hit;
}
int ItemPunchHand()
{
switch (type)
{
case ItemType.Rock:
return 2;
case ItemType.Ball:
return 2;
case ItemType.Cooking:
return 2;
case ItemType.Alien:
return 2;
case ItemType.TacoBell:
return 2;
default:
return 0;
}
}
void JoeComboSequence()
{
var joe = KarateManNew.instance.Joe;
@ -183,8 +265,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
Jukebox.PlayOneShotGame("karateman/swingNoHit_Alt", forcePlay: true);
else
{
Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
status = FlyStatus.Hit;
ItemHitEffect();
}
break;
case ItemType.ComboPot3:
@ -192,8 +273,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (joe.GetComboId() != comboId) {}
else
{
Jukebox.PlayOneShotGame("karateman/comboHit2", forcePlay: true);
status = FlyStatus.Hit;
ItemHitEffect();
}
break;
case ItemType.ComboPot4:
@ -206,8 +286,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
else
{
joe.ComboSequence(1);
Jukebox.PlayOneShotGame("karateman/comboHit3", forcePlay: true);
status = FlyStatus.Hit;
ItemHitEffect();
}
break;
case ItemType.ComboPot5:
@ -215,8 +294,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (joe.GetComboId() != comboId) {}
else
{
Jukebox.PlayOneShotGame("karateman/comboHit3", forcePlay: true);
status = FlyStatus.Hit;
ItemHitEffect();
}
break;
default:
@ -226,14 +304,15 @@ namespace HeavenStudio.Games.Scripts_KarateMan
public void ItemJustOrNg(PlayerActionEvent caller, float state)
{
if (status == FlyStatus.Fly) {
KarateManNew.instance.Joe.Punch();
var joe = KarateManNew.instance.Joe;
if (status == FlyStatus.Fly && !joe.inCombo) {
joe.Punch(ItemPunchHand());
if (state <= -1f || state >= 1f) {
Jukebox.PlayOneShot("miss");
status = FlyStatus.NG;
}
else {
Jukebox.PlayOneShotGame("karateman/potHit", forcePlay: true);
ItemHitEffect();
status = FlyStatus.Hit;
}
}
@ -242,12 +321,25 @@ namespace HeavenStudio.Games.Scripts_KarateMan
public void ItemWrongAction(PlayerActionEvent caller, float state)
{
//hitting a normal object with the alt input
//WHEN SCORING THIS IS A MISS
var joe = KarateManNew.instance.Joe;
if (status == FlyStatus.Fly && !joe.inCombo) {
joe.ForceFailCombo(Conductor.instance.songPositionInBeats);
if (state <= -1f || state >= 1f) {
Jukebox.PlayOneShot("miss");
status = FlyStatus.NG;
}
else {
ItemHitEffect();
}
}
}
public void ItemOut(PlayerActionEvent caller) {}
public void ItemThrough(PlayerActionEvent caller)
{
if (status != FlyStatus.Fly || gameObject == null) return;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(startBeat + 2f, delegate {
@ -270,18 +362,32 @@ namespace HeavenStudio.Games.Scripts_KarateMan
status = FlyStatus.NG;
}
else {
Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
status = FlyStatus.Hit;
ItemHitEffect();
}
}
}
public void ComboStartOut(PlayerActionEvent caller) {}
public void ComboStartThrough(PlayerActionEvent caller) {}
public void ComboStartThrough(PlayerActionEvent caller)
{
if (status != FlyStatus.Fly || gameObject == null) return;
}
public void ComboStartWrongAction(PlayerActionEvent caller, float state)
{
//hitting a combo start object with the normal input
//hitting a combo start with the normal input
//WHEN SCORING THIS IS A MISS
var joe = KarateManNew.instance.Joe;
if (status == FlyStatus.Fly && !joe.inCombo) {
joe.Punch(ItemPunchHand());
if (state <= -1f || state >= 1f) {
Jukebox.PlayOneShot("miss");
status = FlyStatus.NG;
}
else {
ItemHitEffect();
}
}
}
public void ComboEndJustOrNg(PlayerActionEvent caller, float state)
@ -291,19 +397,42 @@ namespace HeavenStudio.Games.Scripts_KarateMan
joe.inCombo = false;
joe.SetComboId(-1);
joe.SetShouldComboId(-1);
//UpperCut
joe.ComboSequence(3);
if (state <= -1f || state >= 1f) {
Jukebox.PlayOneShot("miss");
status = FlyStatus.NG;
}
else {
Jukebox.PlayOneShotGame("karateman/comboHit4", forcePlay: true);
status = FlyStatus.Hit;
ItemHitEffect();
}
}
}
public void ComboEndOut(PlayerActionEvent caller) {}
public void ComboEndThrough(PlayerActionEvent caller) {}
public void ComboEndThrough(PlayerActionEvent caller)
{
if (status != FlyStatus.Fly || gameObject == null) return;
var joe = KarateManNew.instance.Joe;
if (joe.GetComboId() != comboId || !joe.inCombo) return;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(startBeat + 1.5f, delegate {
joe.inCombo = false;
joe.SetComboId(-1);
joe.SetShouldComboId(-1);
joe.ComboSequence(4);
})
});
}
public void ComboEndWrongAction(PlayerActionEvent caller, float state)
{
KarateManNew.instance.Joe.Punch(1);
}
public void ComboEndWrongActionAlt(PlayerActionEvent caller, float state)
{
KarateManNew.instance.Joe.ForceFailCombo(Conductor.instance.songPositionInBeats);
}
}
}