mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:27:40 +02:00
Some facial expressions for Karate Man
This commit is contained in:
@ -8,31 +8,29 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
{
|
||||
public class KarateJoe : MonoBehaviour
|
||||
{
|
||||
|
||||
[Header("Components")]
|
||||
public Animator anim;
|
||||
|
||||
private int currentHitInList = 0;
|
||||
|
||||
public GameObject HitEffect;
|
||||
|
||||
[Header("Particles")]
|
||||
public ParticleSystem HitParticle;
|
||||
public ParticleSystem RockParticle;
|
||||
public GameObject BulbHit;
|
||||
[SerializeField] private SpriteRenderer head;
|
||||
[SerializeField] private Sprite[] heads;
|
||||
[SerializeField] private GameObject missEffect;
|
||||
|
||||
[Header("Properties")]
|
||||
public bool hitBarrel = false;
|
||||
public Coroutine kickC;
|
||||
|
||||
public Coroutine missC;
|
||||
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 float comboNormalizedBeat = 0;
|
||||
|
||||
public static KarateJoe instance { get; set; }
|
||||
@ -294,5 +292,21 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
anim.Play(name, 0, 0);
|
||||
anim.speed = 1;
|
||||
}
|
||||
|
||||
public void SetHead(int index)
|
||||
{
|
||||
head.sprite = heads[index];
|
||||
}
|
||||
|
||||
public IEnumerator Miss()
|
||||
{
|
||||
// I couldn't find the sound for this
|
||||
GameObject miss = Instantiate(missEffect, missEffect.transform.parent);
|
||||
miss.SetActive(true);
|
||||
SetHead(2);
|
||||
yield return new WaitForSeconds(0.08f);
|
||||
Destroy(miss);
|
||||
SetHead(0);
|
||||
}
|
||||
}
|
||||
}
|
@ -76,6 +76,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
GameObject pot = Instantiate(Pot);
|
||||
pot.transform.parent = Pot.transform.parent;
|
||||
|
||||
KarateJoe.instance.SetHead(0);
|
||||
|
||||
Pot p = pot.GetComponent<Pot>();
|
||||
|
||||
|
@ -49,6 +49,8 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
|
||||
public Vector2 endShadowThrowPos;
|
||||
|
||||
private int missTimes = 0;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
anim = GetComponent<Animator>();
|
||||
@ -139,6 +141,14 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
lastShadowX = Shadow.transform.localPosition.x;
|
||||
lastRot = Holder.transform.GetChild(0).eulerAngles.z;
|
||||
|
||||
if (combo && comboIndex == 0 || combo && comboIndex == 5 || !combo)
|
||||
if (normalizedBeat >= 2 && missTimes == 0)
|
||||
{
|
||||
if (KarateJoe.instance.missC != null) StopCoroutine(KarateJoe.instance.missC);
|
||||
KarateJoe.instance.missC = KarateJoe.instance.StartCoroutine(KarateJoe.instance.Miss());
|
||||
missTimes = 1;
|
||||
}
|
||||
|
||||
StateCheck(normalizedBeat);
|
||||
|
||||
if (!combo)
|
||||
@ -271,6 +281,8 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
{
|
||||
Jukebox.PlayOneShot("miss");
|
||||
|
||||
KarateJoe.instance.SetHead(3);
|
||||
|
||||
NewHolder();
|
||||
Holder.transform.parent = newHolder.transform;
|
||||
|
||||
|
Reference in New Issue
Block a user