using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlaneBomb : MonoBehaviour {

    public GameObject explosion;


	void Start () {
		
	}
	
	void Update () {
		
	}

    void OnTriggerEnter2D(Collider2D collision) {
        if (collision.tag == "Foreground") {
            GameObject exploded = (GameObject) Instantiate(explosion, transform.position, transform.rotation);
            Destroy(gameObject);
            Destroy(exploded, 0.7f);
        }

        if (collision.tag == "Player") {
            PlayerHealth.instance.PlayerDamage(5);
            GameObject exploded = (GameObject)Instantiate(explosion, transform.position, transform.rotation);
            Destroy(gameObject);
            Destroy(exploded, 0.7f);
        }

        if (collision.tag == "PlayerBullet") {
            GameObject exploded = (GameObject)Instantiate(explosion, transform.position, transform.rotation);
            Destroy(gameObject);
            Destroy(exploded, 0.7f);
        }
    }


}
