//Collider col = Physics.OverlapBox(enemyCheck.position, 0.6f, LayerEnemy); void OnTriggerEnter(Collider col) { if (m_dead) { return; } if (col.gameObject.tag == "Shell") { SCT_Shell shell = col.GetComponent <SCT_Shell> (); Damage(shell.shellDamage); } }
//Collider col = Physics.OverlapBox(enemyCheck.position, 0.6f, LayerEnemy); void OnTriggerEnter(Collider col) { if (m_dead) { return; } if (col.gameObject.tag == "Shell") { SCT_Shell shell = col.GetComponent <SCT_Shell> (); Damage(shell.shellDamage); if (currentHealth > 0) { var a = (int)Random.Range(1, 5); if (a == 1) { animator.SetBool("HitLeft", true); } if (a == 2) { animator.SetBool("HitRight", true); } if (a == 3) { animator.SetBool("HitForw", true); } if (a == 4) { animator.SetBool("HitBack", true); } if (a == 5) { animator.SetBool("HitStrong", true); } animDo = "Hit"; } } }