private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Enemy")) { Health_System hp = this.gameObject.GetComponent <Health_System>(); hp.TakeDamage(damage); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Enemy")) { Health_System hp = collision.GetComponent <Health_System>(); hp.TakeDamage(damage); Instantiate(bulletExplosion, transform.position, Quaternion.identity); Destroy(this.gameObject); } }
void OnTriggerEnter(Collider otherCollider) { if (otherCollider.tag != m_TagToIgnore) { Health_System <int> health = otherCollider.GetComponent <Health_System <int> >(); if (health != null) { health.TakeDamage(m_Damage); } Destroy(gameObject); Instantiate(m_SplatterParticlesPrefab, transform.position, Quaternion.identity); } }