mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:07:38 +02:00
Karate man combos
This commit is contained in:
54
Assets/Scripts/Games/KarateMan/ComboSound.cs
Normal file
54
Assets/Scripts/Games/KarateMan/ComboSound.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using RhythmHeavenMania.Util;
|
||||
|
||||
namespace RhythmHeavenMania.Games.KarateMan
|
||||
{
|
||||
public class ComboSound : MonoBehaviour
|
||||
{
|
||||
public float startBeat;
|
||||
private int index;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(startBeat, 1);
|
||||
|
||||
if (normalizedBeat >= 1 && index < 1)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("karateman/punchy1");
|
||||
index++;
|
||||
}
|
||||
else if (normalizedBeat >= 1.25f && index < 2)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("karateman/punchy2");
|
||||
index++;
|
||||
}
|
||||
else if (normalizedBeat >= 1.5f && index < 3)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("karateman/punchy3");
|
||||
index++;
|
||||
}
|
||||
else if (normalizedBeat >= 1.75f && index < 4)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("karateman/punchy4");
|
||||
index++;
|
||||
}
|
||||
else if (normalizedBeat >= 2f && index < 5)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("karateman/ko");
|
||||
index++;
|
||||
}
|
||||
else if (normalizedBeat >= 2.5f && index < 6)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("karateman/pow");
|
||||
index++;
|
||||
}
|
||||
else if (normalizedBeat >= 3)
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/KarateMan/ComboSound.cs.meta
Normal file
11
Assets/Scripts/Games/KarateMan/ComboSound.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59918d58846257448a659991cf2d031b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -24,6 +24,15 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
|
||||
private float barrelBeat;
|
||||
|
||||
private bool inCombo;
|
||||
private bool hitCombo;
|
||||
private float comboBeat;
|
||||
|
||||
public List<Pot> currentComboPots = new List<Pot>();
|
||||
private int comboPotIndex;
|
||||
private int currentComboHitInList;
|
||||
private int comboIndex;
|
||||
|
||||
public static KarateJoe instance { get; set; }
|
||||
|
||||
private void Start()
|
||||
@ -34,6 +43,98 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (inCombo)
|
||||
{
|
||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(comboBeat, 1);
|
||||
|
||||
if (hitCombo)
|
||||
{
|
||||
if (currentComboPots[comboPotIndex] == null) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
normalizedBeat += 1;
|
||||
}
|
||||
|
||||
if (normalizedBeat >= 1 && comboIndex < 1)
|
||||
{
|
||||
if (hitCombo)
|
||||
{
|
||||
currentComboPots[comboPotIndex].Hit();
|
||||
comboPotIndex++;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit1");
|
||||
}
|
||||
comboIndex++;
|
||||
anim.Play("PunchLeft", 0, 0);
|
||||
}
|
||||
else if (normalizedBeat >= 1.25f && comboIndex < 2)
|
||||
{
|
||||
if (hitCombo)
|
||||
{
|
||||
currentComboPots[comboPotIndex].Hit();
|
||||
comboPotIndex++;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit1");
|
||||
}
|
||||
comboIndex++;
|
||||
anim.Play("PunchRight", 0, 0);
|
||||
}
|
||||
else if (normalizedBeat >= 1.5f && comboIndex < 3)
|
||||
{
|
||||
if (hitCombo)
|
||||
{
|
||||
currentComboPots[comboPotIndex].Hit();
|
||||
comboPotIndex++;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit2");
|
||||
}
|
||||
comboIndex++;
|
||||
anim.Play("ComboCrouch", 0, 0);
|
||||
}
|
||||
else if (normalizedBeat >= 1.75f && comboIndex < 4)
|
||||
{
|
||||
if (hitCombo)
|
||||
{
|
||||
currentComboPots[comboPotIndex].Hit();
|
||||
comboPotIndex++;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit3");
|
||||
}
|
||||
comboIndex++;
|
||||
anim.Play("ComboKick", 0, 0);
|
||||
}
|
||||
else if (normalizedBeat >= 2f && comboIndex < 5)
|
||||
{
|
||||
if (hitCombo)
|
||||
{
|
||||
currentComboPots[comboPotIndex].Hit();
|
||||
comboPotIndex++;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit3");
|
||||
}
|
||||
comboIndex++;
|
||||
anim.Play("ComboCrouchPunch", 0, 0);
|
||||
}
|
||||
else if (normalizedBeat >= 2.05f)
|
||||
{
|
||||
if (hitCombo)
|
||||
{
|
||||
if (PlayerInput.AltPressedUp())
|
||||
{
|
||||
ComboPow();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// fail anim
|
||||
anim.Play("Idle");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PlayerInput.AltPressed())
|
||||
{
|
||||
Combo();
|
||||
}
|
||||
}
|
||||
|
||||
if (hitBarrel)
|
||||
{
|
||||
if (PlayerInput.PressedUp())
|
||||
@ -53,13 +154,66 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PlayerInput.Pressed())
|
||||
if (PlayerInput.Pressed() && !inCombo)
|
||||
{
|
||||
Swing();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Combo()
|
||||
{
|
||||
var EligibleHits = KarateMan.instance.EligibleCombos;
|
||||
bool canHit = (EligibleHits.Count > 0) && (currentComboHitInList < EligibleHits.Count);
|
||||
|
||||
if (canHit)
|
||||
{
|
||||
if (KarateMan.instance.EligibleCombos[currentComboHitInList].perfect)
|
||||
{
|
||||
comboBeat = EligibleHits[currentComboHitInList].createBeat;
|
||||
hitCombo = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
comboBeat = Conductor.instance.songPositionInBeats;
|
||||
hitCombo = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
comboBeat = Conductor.instance.songPositionInBeats;
|
||||
hitCombo = false;
|
||||
}
|
||||
|
||||
inCombo = true;
|
||||
}
|
||||
|
||||
private void ComboPow()
|
||||
{
|
||||
if (!hitCombo || !inCombo || !hitCombo && !inCombo) return;
|
||||
|
||||
anim.Play("Pow", 0, 0);
|
||||
|
||||
if (currentComboPots[comboPotIndex].state.perfect)
|
||||
{
|
||||
BarrelDestroy(currentComboPots[comboPotIndex]);
|
||||
Destroy(currentComboPots[comboPotIndex].gameObject);
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit4");
|
||||
}
|
||||
else
|
||||
{
|
||||
Jukebox.PlayOneShot("miss");
|
||||
currentComboPots[comboPotIndex].Miss();
|
||||
}
|
||||
|
||||
hitCombo = false;
|
||||
inCombo = false;
|
||||
comboPotIndex = 0;
|
||||
comboIndex = 0;
|
||||
currentComboHitInList = 0;
|
||||
currentComboPots.Clear();
|
||||
}
|
||||
|
||||
private IEnumerator PrepareKick()
|
||||
{
|
||||
barrelBeat = Conductor.instance.songPositionInBeats;
|
||||
@ -116,67 +270,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
case 4:
|
||||
if (kickC != null) StopCoroutine(kickC);
|
||||
kickC = StartCoroutine(PrepareKick());
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
GameObject be = new GameObject();
|
||||
be.transform.localPosition = p.transform.localPosition;
|
||||
be.transform.parent = this.transform.parent;
|
||||
be.transform.localScale = p.Holder.transform.localScale;
|
||||
BarrelDestroyEffect bde = be.AddComponent<BarrelDestroyEffect>();
|
||||
Vector3 pos = be.transform.localPosition;
|
||||
SpriteRenderer sprite = be.AddComponent<SpriteRenderer>();
|
||||
|
||||
bde.shadow = Instantiate(p.Shadow, transform.parent);
|
||||
bde.shadow.transform.position = p.Shadow.transform.position;
|
||||
bde.shadow.transform.localScale = p.Shadow.transform.lossyScale;
|
||||
bde.index = i;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
be.transform.localPosition = new Vector3(pos.x, pos.y + 1.25f);
|
||||
sprite.sortingOrder = 35;
|
||||
bde.spriteIndex = 3;
|
||||
break;
|
||||
case 1:
|
||||
be.transform.localPosition = new Vector3(pos.x, pos.y + -0.55f);
|
||||
sprite.sortingOrder = 31;
|
||||
bde.spriteIndex = 3;
|
||||
break;
|
||||
case 2:
|
||||
be.transform.localPosition = new Vector3(pos.x - 0.8f, pos.y + 0.45f);
|
||||
sprite.sortingOrder = 32;
|
||||
bde.spriteIndex = 0;
|
||||
break;
|
||||
case 3:
|
||||
be.transform.localPosition = new Vector3(pos.x - 0.5f, pos.y + 0.45f);
|
||||
sprite.sortingOrder = 33;
|
||||
bde.spriteIndex = 1;
|
||||
break;
|
||||
case 4:
|
||||
be.transform.localPosition = new Vector3(pos.x, pos.y + 0.45f);
|
||||
sprite.sortingOrder = 34;
|
||||
bde.spriteIndex = 2;
|
||||
break;
|
||||
case 5:
|
||||
be.transform.localPosition = new Vector3(pos.x + 0.5f, pos.y + 0.45f);
|
||||
sprite.sortingOrder = 33;
|
||||
sprite.flipX = true;
|
||||
bde.spriteIndex = 1;
|
||||
break;
|
||||
case 6:
|
||||
be.transform.localPosition = new Vector3(pos.x + 0.8f, pos.y + 0.45f);
|
||||
sprite.sortingOrder = 32;
|
||||
sprite.flipX = true;
|
||||
bde.spriteIndex = 0;
|
||||
break;
|
||||
case 7:
|
||||
be.transform.localPosition = new Vector3(pos.x, pos.y + 1.25f);
|
||||
sprite.sortingOrder = 39;
|
||||
bde.spriteIndex = 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
BarrelDestroy(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -207,5 +301,70 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
hit.SetActive(true);
|
||||
Destroy(hit, 0.06f);
|
||||
}
|
||||
|
||||
private void BarrelDestroy(Pot p)
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
GameObject be = new GameObject();
|
||||
be.transform.localPosition = p.Holder.transform.localPosition;
|
||||
be.transform.parent = this.transform.parent;
|
||||
be.transform.localScale = p.Holder.transform.localScale;
|
||||
BarrelDestroyEffect bde = be.AddComponent<BarrelDestroyEffect>();
|
||||
Vector3 pos = be.transform.localPosition;
|
||||
SpriteRenderer sprite = be.AddComponent<SpriteRenderer>();
|
||||
|
||||
bde.shadow = Instantiate(p.Shadow, transform.parent);
|
||||
bde.shadow.transform.position = p.Shadow.transform.position;
|
||||
bde.shadow.transform.localScale = p.Shadow.transform.lossyScale;
|
||||
bde.index = i;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
be.transform.localPosition = new Vector3(pos.x, pos.y + 1.25f);
|
||||
sprite.sortingOrder = 35;
|
||||
bde.spriteIndex = 3;
|
||||
break;
|
||||
case 1:
|
||||
be.transform.localPosition = new Vector3(pos.x, pos.y + -0.55f);
|
||||
sprite.sortingOrder = 31;
|
||||
bde.spriteIndex = 3;
|
||||
break;
|
||||
case 2:
|
||||
be.transform.localPosition = new Vector3(pos.x - 0.8f, pos.y + 0.45f);
|
||||
sprite.sortingOrder = 32;
|
||||
bde.spriteIndex = 0;
|
||||
break;
|
||||
case 3:
|
||||
be.transform.localPosition = new Vector3(pos.x - 0.5f, pos.y + 0.45f);
|
||||
sprite.sortingOrder = 33;
|
||||
bde.spriteIndex = 1;
|
||||
break;
|
||||
case 4:
|
||||
be.transform.localPosition = new Vector3(pos.x, pos.y + 0.45f);
|
||||
sprite.sortingOrder = 34;
|
||||
bde.spriteIndex = 2;
|
||||
break;
|
||||
case 5:
|
||||
be.transform.localPosition = new Vector3(pos.x + 0.5f, pos.y + 0.45f);
|
||||
sprite.sortingOrder = 33;
|
||||
sprite.flipX = true;
|
||||
bde.spriteIndex = 1;
|
||||
break;
|
||||
case 6:
|
||||
be.transform.localPosition = new Vector3(pos.x + 0.8f, pos.y + 0.45f);
|
||||
sprite.sortingOrder = 32;
|
||||
sprite.flipX = true;
|
||||
bde.spriteIndex = 0;
|
||||
break;
|
||||
case 7:
|
||||
be.transform.localPosition = new Vector3(pos.x, pos.y + 1.25f);
|
||||
sprite.sortingOrder = 39;
|
||||
bde.spriteIndex = 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -11,6 +11,8 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
public GameObject Pot, Bomb;
|
||||
public KarateJoe KarateJoe;
|
||||
|
||||
public List<Minigame.Eligible> EligibleCombos = new List<Minigame.Eligible>();
|
||||
|
||||
public static KarateMan instance { get; set; }
|
||||
|
||||
public Sprite[] ObjectSprites;
|
||||
@ -27,6 +29,8 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
|
||||
private float bgBeat;
|
||||
|
||||
public GameObject comboRef;
|
||||
|
||||
[System.Serializable]
|
||||
public class BGSpriteC
|
||||
{
|
||||
@ -38,6 +42,88 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public void Combo(float beat)
|
||||
{
|
||||
comboRef.GetComponent<Animator>().enabled = true;
|
||||
comboRef.GetComponent<Animator>().Play("comboRef");
|
||||
Jukebox.PlayOneShotGame("karateman/barrelOutCombos");
|
||||
|
||||
Shoot(beat, 0, true, "PotCombo1", 0, new Vector2(-0.94f, -2.904f));
|
||||
Shoot(beat + 0.25f, 0, true, "PotCombo2", 1, new Vector2(-0.94f, -2.904f));
|
||||
Shoot(beat + 0.5f, 0, true, "PotCombo3", 2, new Vector2(-0.776f, -3.162f));
|
||||
Shoot(beat + 0.75f, 0, true, "PotCombo4", 3, new Vector2(1.453f, -3.162f));
|
||||
Shoot(beat + 1f, 0, true, "PotCombo5", 4, new Vector2(0.124f, -3.123f));
|
||||
Shoot(beat + 1.5f, 4, true, "PotCombo6", 5, new Vector2(-1.333f, -2.995f));
|
||||
|
||||
GameObject cs = new GameObject(); cs.AddComponent<ComboSound>().startBeat = beat;
|
||||
cs.transform.parent = this.transform.parent;
|
||||
}
|
||||
|
||||
public void Shoot(float beat, int type, bool combo = false, string throwAnim = "", int comboIndex = 0, Vector2 endShadowPos = new Vector2())
|
||||
{
|
||||
GameObject pot = Instantiate(Pot);
|
||||
pot.transform.parent = Pot.transform.parent;
|
||||
|
||||
|
||||
Pot p = pot.GetComponent<Pot>();
|
||||
|
||||
pot.SetActive(true);
|
||||
p.startBeat = beat;
|
||||
p.createBeat = beat;
|
||||
p.isThrown = true;
|
||||
p.type = type;
|
||||
p.Sprite.GetComponent<SpriteRenderer>().sprite = ObjectSprites[type];
|
||||
|
||||
if (combo)
|
||||
{
|
||||
p.comboIndex = comboIndex;
|
||||
p.throwAnim = throwAnim;
|
||||
p.combo = true;
|
||||
KarateJoe.currentComboPots.Add(p);
|
||||
p.endShadowThrowPos = endShadowPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
p.throwAnim = "PotThrow";
|
||||
|
||||
string outSnd = "";
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
if (Starpelly.Mathp.GetDecimalFromFloat(beat) == 0f)
|
||||
outSnd = "karateman/objectOut";
|
||||
else
|
||||
outSnd = "karateman/offbeatObjectOut";
|
||||
p.hitSnd = "karateman/potHit";
|
||||
break;
|
||||
case 1:
|
||||
outSnd = "karateman/lightbulbOut";
|
||||
p.hitSnd = "karateman/lightbulbHit";
|
||||
break;
|
||||
case 2:
|
||||
outSnd = "karateman/objectOut";
|
||||
p.hitSnd = "karateman/rockHit";
|
||||
break;
|
||||
case 3:
|
||||
outSnd = "karateman/objectOut";
|
||||
p.hitSnd = "karateman/soccerHit";
|
||||
break;
|
||||
case 4:
|
||||
p.kick = true;
|
||||
outSnd = "karateman/barrelOutKicks";
|
||||
p.hitSnd = "karateman/barrelBreak";
|
||||
|
||||
GameObject pks = new GameObject(); pks.AddComponent<PunchKickSound>().startBeat = beat;
|
||||
pks.transform.parent = this.transform.parent;
|
||||
break;
|
||||
}
|
||||
|
||||
p.endShadowThrowPos = new Vector2(-1.036f, -2.822f);
|
||||
|
||||
Jukebox.PlayOneShotGame(outSnd);
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Conductor.instance.ReportBeat(ref newBeat))
|
||||
@ -78,52 +164,6 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
BGSprite.sprite = BGSprites[0].Sprites[0];
|
||||
}
|
||||
|
||||
public void Shoot(float beat, int type)
|
||||
{
|
||||
GameObject pot = Instantiate(Pot);
|
||||
pot.transform.parent = Pot.transform.parent;
|
||||
|
||||
Pot p = pot.GetComponent<Pot>();
|
||||
|
||||
pot.SetActive(true);
|
||||
p.startBeat = beat;
|
||||
p.createBeat = beat;
|
||||
p.isThrown = true;
|
||||
p.type = type;
|
||||
p.Sprite.GetComponent<SpriteRenderer>().sprite = ObjectSprites[type];
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
if (Starpelly.Mathp.GetDecimalFromFloat(beat) == 0f)
|
||||
Jukebox.PlayOneShotGame("karateman/objectOut");
|
||||
else
|
||||
Jukebox.PlayOneShotGame("karateman/offbeatObjectOut");
|
||||
p.hitSnd = "karateman/potHit";
|
||||
break;
|
||||
case 1:
|
||||
Jukebox.PlayOneShotGame("karateman/lightbulbOut");
|
||||
p.hitSnd = "karateman/lightbulbHit";
|
||||
break;
|
||||
case 2:
|
||||
Jukebox.PlayOneShotGame("karateman/objectOut");
|
||||
p.hitSnd = "karateman/rockHit";
|
||||
break;
|
||||
case 3:
|
||||
Jukebox.PlayOneShotGame("karateman/objectOut");
|
||||
p.hitSnd = "karateman/soccerHit";
|
||||
break;
|
||||
case 4:
|
||||
p.kick = true;
|
||||
Jukebox.PlayOneShotGame("karateman/barrelOutKicks");
|
||||
p.hitSnd = "karateman/barrelBreak";
|
||||
|
||||
GameObject pks = new GameObject(); pks.AddComponent<PunchKickSound>().startBeat = beat;
|
||||
pks.transform.parent = this.transform.parent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Bop(float beat, float length)
|
||||
{
|
||||
bopLength = length;
|
||||
|
@ -41,23 +41,52 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
|
||||
public float lastPotRot;
|
||||
|
||||
public string throwAnim;
|
||||
public bool combo;
|
||||
public int comboIndex;
|
||||
|
||||
public Vector2 endShadowThrowPos;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
anim = GetComponent<Animator>();
|
||||
|
||||
Sprite.transform.eulerAngles = new Vector3(0, 0, Random.Range(0, 360));
|
||||
isEligible = true;
|
||||
|
||||
if (type == 2)
|
||||
hitLength = 14f;
|
||||
else
|
||||
hitLength = 14f;
|
||||
|
||||
PlayerActionInit(this.gameObject, createBeat, KarateMan.instance.EligibleHits);
|
||||
if (combo)
|
||||
{
|
||||
if (comboIndex == 0)
|
||||
{
|
||||
isEligible = true;
|
||||
PlayerActionInit(this.gameObject, createBeat, KarateMan.instance.EligibleCombos);
|
||||
}
|
||||
else if (comboIndex == 5)
|
||||
{
|
||||
isEligible = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isEligible = true;
|
||||
PlayerActionInit(this.gameObject, createBeat, KarateMan.instance.EligibleHits);
|
||||
}
|
||||
|
||||
Sprite.GetComponent<SpriteRenderer>().enabled = false;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Conductor.instance.songPositionInBeats >= createBeat)
|
||||
Sprite.GetComponent<SpriteRenderer>().enabled = true;
|
||||
else
|
||||
Sprite.GetComponent<SpriteRenderer>().enabled = false;
|
||||
|
||||
|
||||
float time2Destroy = Conductor.instance.GetLoopPositionFromBeat(createBeat, 4);
|
||||
|
||||
if (time2Destroy >= 1)
|
||||
@ -65,21 +94,28 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
|
||||
if (isThrown)
|
||||
{
|
||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, 2.22000000002f);
|
||||
anim.Play("PotThrow", 0, normalizedBeatAnim);
|
||||
float animTime = 2.22000000002f;
|
||||
float beatTime = 1f;
|
||||
if (comboIndex == 5)
|
||||
{
|
||||
animTime = 2.27777777777f;
|
||||
}
|
||||
|
||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, animTime);
|
||||
anim.Play(throwAnim, 0, normalizedBeatAnim);
|
||||
anim.speed = 0;
|
||||
|
||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(startBeat, 1);
|
||||
|
||||
StateCheck(normalizedBeat);
|
||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatTime);
|
||||
|
||||
Shadow.transform.localScale = Vector3.Lerp(new Vector3(4.12f, 4.12f), new Vector3(0.34f, 0.34f), shadowCurveScale.Evaluate(normalizedBeatAnim));
|
||||
Shadow.transform.localPosition = new Vector3(Mathf.Lerp(7.63f, -1.036f, shadowCurve.Evaluate(normalizedBeatAnim)), Mathf.Lerp(-12.26f, -2.822f, shadowCurve.Evaluate(normalizedBeatAnim)));
|
||||
Shadow.transform.localPosition = new Vector3(Mathf.Lerp(7.63f, endShadowThrowPos.x, shadowCurve.Evaluate(normalizedBeatAnim)), Mathf.Lerp(-12.26f, endShadowThrowPos.y, shadowCurve.Evaluate(normalizedBeatAnim)));
|
||||
|
||||
lastPos = Holder.transform.localPosition;
|
||||
lastPotRot = Holder.transform.eulerAngles.z;
|
||||
lastShadowX = Shadow.transform.localPosition.x;
|
||||
lastRot = Holder.transform.GetChild(0).eulerAngles.z;
|
||||
|
||||
StateCheck(normalizedBeat);
|
||||
}
|
||||
|
||||
if (!isHit && !isThrown)
|
||||
|
@ -35,6 +35,10 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
Jukebox.PlayOneShotGame("karateman/punchKick4");
|
||||
index++;
|
||||
}
|
||||
else if (normalizedBeat >= 3)
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -92,6 +92,7 @@ namespace RhythmHeavenMania
|
||||
new GameAction("rock", delegate { KarateMan.instance.Shoot(eventCaller.currentBeat, 2); }, 2, true),
|
||||
new GameAction("ball", delegate { KarateMan.instance.Shoot(eventCaller.currentBeat, 3); }, 2, true),
|
||||
new GameAction("kick", delegate { KarateMan.instance.Shoot(eventCaller.currentBeat, 4); }, 4.5f, true),
|
||||
new GameAction("combo", delegate { KarateMan.instance.Combo(eventCaller.currentBeat); }, 4f, true),
|
||||
new GameAction("bgfxon", delegate { KarateMan.instance.BGFXOn(); } ),
|
||||
new GameAction("bgfxoff", delegate { KarateMan.instance.BGFXOff(); }),
|
||||
})
|
||||
|
@ -20,5 +20,21 @@ namespace RhythmHeavenMania
|
||||
{
|
||||
return Input.GetKey(KeyCode.Z);
|
||||
}
|
||||
|
||||
|
||||
public static bool AltPressed()
|
||||
{
|
||||
return Input.GetKeyDown(KeyCode.X);
|
||||
}
|
||||
|
||||
public static bool AltPressedUp()
|
||||
{
|
||||
return Input.GetKeyUp(KeyCode.X);
|
||||
}
|
||||
|
||||
public static bool AltPressing()
|
||||
{
|
||||
return Input.GetKey(KeyCode.X);
|
||||
}
|
||||
}
|
||||
}
|
@ -40,12 +40,10 @@ namespace RhythmHeavenMania.Util
|
||||
{
|
||||
audioSource.Pause();
|
||||
pauseTimes = 1;
|
||||
print("paused");
|
||||
}
|
||||
else if (Conductor.instance.isPlaying && !Conductor.instance.isPaused && pauseTimes == 1)
|
||||
{
|
||||
audioSource.Play();
|
||||
print("played");
|
||||
pauseTimes = 0;
|
||||
}
|
||||
|
||||
@ -57,6 +55,11 @@ namespace RhythmHeavenMania.Util
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
if (Conductor.instance.songPosition < startTime)
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user