void OnTriggerEnter2D(Collider2D other) { Patrol enemy = other.GetComponent <Patrol>(); if (enemy != null) { enemy.TakeDamage(damage); Instantiate(impactEffect, transform.position, transform.rotation); } }
void OnTriggerEnter2D(Collider2D other) { Patrol enemy = other.GetComponent <Patrol>(); if (enemy != null) { enemy.TakeDamage(damage); Instantiate(impactEffect, transform.position, transform.rotation); } if (other.gameObject.tag != "Bullet") { Destroy(gameObject); } }
void OnTriggerEnter2D(Collider2D hitInfo) { Patrol enemy = hitInfo.GetComponent <Patrol> (); if (enemy != null) { enemy.TakeDamage(damage); } GameObject explosion = (GameObject)Instantiate(impactEffect, transform.position, transform.rotation); Destroy(explosion, 6 / 10f); Destroy(gameObject); }