Added the Rube Goldberg MAchine
This commit is contained in:
@@ -2,9 +2,24 @@ using UnityEngine;
|
||||
|
||||
public class Destroyer : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private GameObject targetToDestroy;
|
||||
|
||||
// Destroy the GameObject this component is attached to
|
||||
public void DestroySelf()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
// Destroy the GameObject assigned in the inspector
|
||||
public void DestroyTarget()
|
||||
{
|
||||
if (targetToDestroy == null)
|
||||
{
|
||||
Debug.LogWarning("Destroyer: No target assigned to destroy.", this);
|
||||
return;
|
||||
}
|
||||
|
||||
Destroy(targetToDestroy);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user