//private float timer = 3f; private void Awake() { if (Instance != null) { Destroy(this); } Instance = this; }
float startTime; // for storing time at which bomb was created // Use this for initialization void Start() { scoreUpText = Resources.Load("1upText") as GameObject; oneUpIcon = Resources.Load("1upIcon") as GameObject; rb = GetComponent <Rigidbody>(); // get rb object animator = GetComponent <Animator>(); // get animator float animationDuration = GetAnimationDuration("ColorChange"); // get duration of bomb clip Invoke("Explode", explosionTime); // initialize explosion Invoke("StartAnimation", explosionTime - animationDuration); // initialize animation startTime = Time.time; // store time at which bomb was spawned gm = FindObjectOfType <BombGameManager>(); }