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

public class PlayerDeath : MonoBehaviour
{
    public FXTrigger deathFX;
    public Transform corposePrefab;

    private Cargo cargo;

    void Start()
    {
        cargo = GetComponent<Cargo>();
    }

    void OnTriggerEnter2D(Collider2D other)
    {
        if(cargo.type == Cargo.ItemType.None)
            return;

        if (other.CompareTag("Enemy"))
        {
            other.gameObject.SendMessage("OnStoleFromPlayer", cargo.type);
            cargo.type = Cargo.ItemType.None;
            Score.ScoreFail();
            deathFX.Trigger(transform);
        }
    }

}
