28 lines
605 B
C#
28 lines
605 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class CubeClash_TimeBomb : MonoBehaviour
|
|
{
|
|
public float countdown = 3f;
|
|
public float radius = 3f;
|
|
|
|
void Start()
|
|
{
|
|
StartCoroutine(ExplodeRoutine());
|
|
}
|
|
|
|
IEnumerator ExplodeRoutine()
|
|
{
|
|
yield return new WaitForSeconds(countdown);
|
|
Collider[] cols = Physics.OverlapSphere(transform.position, radius);
|
|
foreach (Collider col in cols)
|
|
{
|
|
if (col.CompareTag("Zibu"))
|
|
{
|
|
Destroy(col.gameObject);
|
|
}
|
|
}
|
|
Destroy(gameObject);
|
|
}
|
|
}
|