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

public class uvuvwevwe : MonoBehaviour {

    public GameObject Spawner;
    public GameObject Playah;

    public GameObject explosionPlayer;
    //   public GameObject explosionEnemy;


    void Start()
    {
        Spawner = GameObject.FindGameObjectWithTag("Spawnmanager");
        Playah = GameObject.FindGameObjectWithTag("Player");
    }
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            Instantiate(explosionPlayer, Spawner.transform);
            Debug.Log("Player Hit");
            Destroy(this.gameObject);
            other.SendMessage("TakeDamage");
            // damage player
           // Spawner.GetComponent<SpawnManager>().remainingAlive--;

            //
        }

        if (other.gameObject.CompareTag("Playerbullet"))
        {
            Debug.Log("Player bullet Hit");
            Playah.GetComponent<PlayerScore>().AddScore(1);
          
                Destroy(this.gameObject);
            }

        }
    
}
