void OnCollisionEnter(Collision collision) { if (collision.gameObject.CompareTag("Enermy")) { if (this.onFire) { EnemyWithFire enemy = collision.gameObject.GetComponentInParent <EnemyWithFire> (); enemy.Burned(); } } }
void OnCollisionEnter(Collision collision) { if (collision.gameObject.CompareTag("Player")) { Player player = collision.gameObject.GetComponent <Player> (); player.Hit(damage); // print ("enemy hit player"); // maybe add attack animation } if (collision.gameObject.CompareTag("Enermy")) { if (this.onFire) { EnemyWithFire enemy = collision.gameObject.GetComponentInParent <EnemyWithFire> (); enemy.Burned(); } } }