Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class ColliderDelay : MonoBehaviour {
- public GameObject Bomb;
- public float colliderDelay = 5.0f;
- bool exploded;
- // Use this for initialization
- void Start () {
- SphereCollider sphereCollider = Bomb.GetComponent<SphereCollider>();
- }
- // Update is called once per frame
- void Update () {
- if(colliderDelay <= 0) {
- Boom();
- } else {
- colliderDelay -= Time.deltaTime;
- }
- }
- void Boom() {
- if(exploded) return;
- exploded = true;
- // Do stuff in here
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement