Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Timer
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bomb : MonoBehaviour
{
// Use this for initialization
void Start()
{
int seconds = 3;
StartCoroutine(Countdown(seconds));
}
private IEnumerator Countdown(int counter)
{
while (counter > 0)
{
yield return new WaitForSeconds(1);
counter--;
}
Explode();
}
void Explode()
{
Destroy(gameObject);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.