Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ColliderDelay : MonoBehaviour {
  5. public GameObject Bomb;
  6. public float colliderDelay = 5.0f;
  7.  
  8. bool exploded;
  9.  
  10.  
  11.  
  12. // Use this for initialization
  13. void Start () {
  14.  
  15.  
  16. SphereCollider sphereCollider = Bomb.GetComponent<SphereCollider>();
  17.  
  18.  
  19. }
  20.  
  21. // Update is called once per frame
  22. void Update () {
  23. if(colliderDelay <= 0) {
  24. Boom();
  25. } else {
  26. colliderDelay -= Time.deltaTime;
  27. }
  28.  
  29. }
  30.  
  31. void Boom() {
  32. if(exploded) return;
  33.  
  34. exploded = true;
  35. // Do stuff in here
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement