using UnityEngine;

public class DropOnDeath : MonoBehaviour {

    public Transform DropPrefab;
    public bool PutInRender = true;

    private Actor actor;
    void Start()
    {
        actor = GetComponent<Actor>();
    } 

	void Died()
    {
        if (DropPrefab == null)
            return;

        if (PutInRender)
            RenderPipeline.RenderCode(() => SpawnActor.SpawnPrefabAt(DropPrefab, actor.Location));
        else
            SpawnActor.SpawnPrefabAt(DropPrefab, actor.Location);
    }
}
