// Update is called once per frame void Update() { if (asc.isPlaying) { clipTimeCounter += Time.deltaTime; wasPlaying = true; } if (!isStarted && pickUpsScript) { CountDownCheck(pickUpsScript.getTimer()); if (pickUpsScript.getTimer() >= -0.02f) { asc.Play(); // start playing background music isStarted = true; } } if (ps) // checking a game object that contains ps is exist or not { if (Input.GetKeyDown(KeyCode.Escape)) { pauseUnpause(); } pauseChecker(); if (ps.isAlive()) // checking the players state is it alive or dead { textRef.text = point.ToString(); if (clipTimeCounter >= asc.clip.length - 0.2f && isStarted) { new WaitForSeconds(2); EndTheGame(); } } else { EndTheGame(); } } else { Time.timeScale = 1; } // when point changes check transfer the point value to the panel controller if (temp != point) { panelController(point); temp = point; } }