void Start() { if (lastHit != null) { GameObject.Destroy(lastHit); } tex = GetComponent <TextMesh>(); int _comboNum = HitCombo.GetComboNum(); tex.text = _comboNum.ToString(); lastHit = this.gameObject; }
void OnCollisionEnter(Collision other) { if (other.transform.CompareTag("Enemy") == true && GameManager.GetGameStatus() == GameManager.GameStatus.Playing && speed > HandSpeed && timer <= 0) { other.transform.GetComponentInParent <EnemyHealth>().TakeDamage(10); audio.clip = HitClip; audio.Play(); GameObject _effect = (GameObject)Instantiate(HitEffect, other.contacts[0].point, Quaternion.identity); ComboSystem.Combo(); if (HitCombo.GetComboNum() > 1) { GameObject _combo = (GameObject)Instantiate(ComboText, other.contacts[0].point, Quaternion.identity); } timer = AttackCD; } }