add explodable script
This commit is contained in:
@@ -2,12 +2,23 @@
|
||||
|
||||
public class BurriedItem : Diggable
|
||||
{
|
||||
public GameObject ItemToSpawn;
|
||||
// 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()
|
||||
{
|
||||
Instantiate(ItemToSpawn, Spawnpoint.position, Spawnpoint.rotation, null);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user