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

public class OnDeathMakeCorpse : MonoBehaviour, Event.ILocalAction<DeathEvent>
{
    [SerializeField] private AudioSource death;
    public GameObject corpsePrefab;
    public float corpseLifespan;

    public void OnEvent(DeathEvent arg)
    {
        death.Play();
        var corpse = Pool.Get(corpsePrefab, transform.position, transform.rotation);
        Pool.Del(corpse, corpseLifespan);
        Pool.Del(gameObject);
    }
}
