add explodable script
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
|
||||
// Put this on an empty game object with a trigger collider. Anything inside of this
|
||||
// trigger collider with an Explodable script will explode
|
||||
public class Explosion : MonoBehaviour
|
||||
{
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other != null)
|
||||
{
|
||||
Explodable explodable = other.GetComponent<Explodable>();
|
||||
if (explodable != null)
|
||||
{
|
||||
explodable.Explode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user