19 lines
487 B
C#
19 lines
487 B
C#
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();
|
|
}
|
|
}
|
|
}
|
|
}
|