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

public class Destroyer : MonoBehaviour {

    private LevelManager levelManager;

    void Start()
    {
        levelManager = GameObject.FindObjectOfType<LevelManager>();

    }


   
    private void OnCollisionEnter2D(Collision2D collision)
    {
        // Debug.Log("collision");
        if (collision.gameObject.name != "Player")
        {
            Debug.Log("destroyed on destroyer");
            GameObject.Find("PickupSpawner").GetComponent<PickupController>().ResetSpawnPoint(int.Parse(collision.gameObject.name));
            Destroy(collision.gameObject);
           
        }
        else
        levelManager.LoadLevel("lose");
    }
}
