Beispiel #1
0
 private void OnTriggerEnter2D(CircleCollider2D collision)
 {
     if (collision.CompareTag("Player"))
     {
         animator.SetTrigger("New Triger");
     }
 }
Beispiel #2
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.collider.name != "BombardierBomb" || collision.collider.name != "Minibomb")
        {
            Collider2D[] collisions = Physics2D.OverlapCircleAll(transform.position, ExplosionRadius);
            foreach (Collider2D col in collisions)
            {
                if (col.CompareTag("ENEMY"))
                {
                    GameMaster.HitEnemy(col.gameObject, 5);
                }
                else if (col.CompareTag("Player"))
                {
                    GameMaster.DamagePlayer(1);
                }
            }
            //TODO SPAWN EXPLOSION PREFAB

            Destroy(this.gameObject);
        }
    }