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

public class DestroyByContactRed : MonoBehaviour
{
    public GameObject playerExplosion;
    private void OnTriggerStay2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Player"))
        {
            Destroy(collision.gameObject);
            Destroy(gameObject);
            Instantiate(playerExplosion, collision.transform.position, collision.transform.rotation);
        }
    }

    private void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Border"))
        {
            Destroy(gameObject);
        }
    }
}
