示例#1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Enemy"))
     {
         Health_System hp = this.gameObject.GetComponent <Health_System>();
         hp.TakeDamage(damage);
     }
 }
示例#2
0
    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);
        }
    }
示例#3
0
    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);
        }
    }