Ejemplo n.º 1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Monster")
        {
            BulletSpawner bulletmonster = other.GetComponent <BulletSpawner>();

            if (bulletmonster != null)
            {
                bulletmonster.GetDamage(attackAmount);
            }
            Destroy(gameObject);
        }
        else if (other.tag == "Monster2")
        {
            MonsterCtrl alien = other.GetComponent <MonsterCtrl>();

            if (alien != null)
            {
                alien.GetDamage(attackAmount);
            }
            Destroy(gameObject);
        }
        else if (other.tag == "START")
        {
            FindObjectOfType <GameManager>().StartGame();
        }
        //Destroy(gameObject);
    }
Ejemplo n.º 2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Monster"))
     {
         BulletSpawner bulletSpawner = other.GetComponent <BulletSpawner>();
         bulletSpawner?.GetDamage(attackAmount);
         Destroy(gameObject);
     }
     if (other.CompareTag("Monster2"))
     {
         MonsterCtrl ailen = other.GetComponent <MonsterCtrl>();
         ailen?.GetDamage(attackAmount);
         Destroy(gameObject);
     }
 }