mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:37:37 +02:00
kicks complete, start work on particles
- bg colour can now be changed
This commit is contained in:
@ -35,8 +35,7 @@ namespace HeavenStudio.Games.Loaders
|
||||
new Param("type", KarateMan.HitThree.HitThree, "Type", "The warning text to show")
|
||||
}),
|
||||
new GameAction("prepare", delegate { }, 1f, true),
|
||||
new GameAction("set background effects", delegate {
|
||||
}, 0.5f, false, new List<Param>()
|
||||
new GameAction("set background effects", delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetBgAndShadowCol(e.beat, e.type, e.type2, e.colorA, e.colorB, e.type3); }, 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"),
|
||||
@ -60,7 +59,7 @@ namespace HeavenStudio.Games.Loaders
|
||||
new Param("type", KarateMan.HitThree.HitThree, "Type", "The warning text to show")
|
||||
},
|
||||
hidden: true),
|
||||
new GameAction("set background color", delegate { }, 0.5f, false,
|
||||
new GameAction("set background color", delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetBgAndShadowCol(e.beat, e.type, e.type2, e.colorA, e.colorB, 0); }, 0.5f, false,
|
||||
new List<Param>()
|
||||
{
|
||||
new Param("type", KarateMan.BackgroundType.Yellow, "Background Type", "The preset background type"),
|
||||
@ -162,6 +161,9 @@ namespace HeavenStudio.Games
|
||||
float wordClearTime = Single.MinValue;
|
||||
const float hitVoiceOffset = 0.042f;
|
||||
|
||||
//backgrounds
|
||||
public SpriteRenderer BGPlane;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
@ -307,6 +309,14 @@ namespace HeavenStudio.Games
|
||||
Jukebox.PlayOneShotGame(outSound, forcePlay: true);
|
||||
}
|
||||
|
||||
public void SetBgAndShadowCol(float beat, int bgType, int shadowType, Color a, Color b, int fx)
|
||||
{
|
||||
if (bgType == (int) BackgroundType.Custom)
|
||||
BGPlane.color = a;
|
||||
else
|
||||
BGPlane.color = BackgroundColors[bgType];
|
||||
}
|
||||
|
||||
public void Combo(float beat)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("karateman/barrelOutCombos", forcePlay: true);
|
||||
@ -349,7 +359,7 @@ namespace HeavenStudio.Games
|
||||
}, forcePlay: true);
|
||||
}
|
||||
|
||||
GameObject CreateItemInstance(float beat, string awakeAnim, KarateManPot.ItemType type = KarateManPot.ItemType.Pot, int comboId = -1)
|
||||
public GameObject CreateItemInstance(float beat, string awakeAnim, KarateManPot.ItemType type = KarateManPot.ItemType.Pot, int comboId = -1)
|
||||
{
|
||||
GameObject mobj = GameObject.Instantiate(Item, ItemHolder);
|
||||
KarateManPot mobjDat = mobj.GetComponent<KarateManPot>();
|
||||
|
@ -29,7 +29,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
public bool inKick = false;
|
||||
float lastChargeTime = Single.MinValue;
|
||||
|
||||
bool inSpecial { get { return inCombo || inKick; } }
|
||||
bool inSpecial { get { return inCombo || Conductor.instance.GetPositionFromBeat(lastChargeTime, 2.75f) <= 0.25f; } }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@ -65,7 +65,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
|
||||
if (inKick)
|
||||
{
|
||||
float chargeProg = cond.GetPositionFromBeat(lastChargeTime, 2.75f);
|
||||
float chargeProg = cond.GetPositionFromBeat(lastChargeTime, 2.75f);
|
||||
if (chargeProg >= 0f && chargeProg < 1f)
|
||||
{
|
||||
anim.DoScaledAnimation("ManCharge", lastChargeTime, 2.75f);
|
||||
@ -107,10 +107,18 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
}
|
||||
}
|
||||
|
||||
if ((!GameManager.instance.autoplay) && (PlayerInput.PressedUp(true) && wantKick && !PlayerInput.Pressing(true)))
|
||||
if ((!GameManager.instance.autoplay) && (PlayerInput.PressedUp(true) && !PlayerInput.Pressing(true)))
|
||||
{
|
||||
//stopped holding, don't charge
|
||||
wantKick = false;
|
||||
if (wantKick)
|
||||
{
|
||||
//stopped holding, don't charge
|
||||
wantKick = false;
|
||||
}
|
||||
else if (inKick && cond.GetPositionFromBeat(lastChargeTime, 2.75f) <= 0.5f && !KarateMan.instance.IsExpectingInputNow())
|
||||
{
|
||||
Kick(cond.songPositionInBeats);
|
||||
Jukebox.PlayOneShotGame("karateman/swingKick", forcePlay: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,6 +127,11 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
if (GameManager.instance.currentGame != "karateman") return false;
|
||||
var cond = Conductor.instance;
|
||||
bool straight = false;
|
||||
|
||||
anim.speed = 1f;
|
||||
lastChargeTime = Single.MinValue;
|
||||
inKick = false;
|
||||
|
||||
switch (forceHand)
|
||||
{
|
||||
case 0:
|
||||
@ -223,8 +236,13 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
public void Kick(float beat)
|
||||
{
|
||||
if (!inKick) return;
|
||||
//play the kick animation and reset stance
|
||||
anim.speed = 1f;
|
||||
bop.startBeat = beat + 2.5f;
|
||||
lastChargeTime = Single.MinValue;
|
||||
inKick = false;
|
||||
bop.startBeat = beat + 2f;
|
||||
|
||||
anim.DoScaledAnimationAsync("ManKick", 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
@ -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