using UnityEngine;

public class BurriedItem : Diggable
{
    // Spawnpoint is optional, will spawn at location of dig spot, translated up 
    // on y-axis
    public Transform Spawnpoint;
    public GameObject ItemToSpawn;

    public override void Dig()
    {
        if (Spawnpoint == null)
        {
            Vector3 newPos = new Vector3(transform.position.x, transform.position.y + 0.2f, transform.position.z);
            Instantiate(ItemToSpawn, newPos, transform.rotation, null);
        }
        else
        {
            Instantiate(ItemToSpawn, Spawnpoint.position, Spawnpoint.rotation, null);
        }

        Destroy(gameObject);
    }
}
