// Update is called once per frame void Update() { if (!SceneMaster.getIsGamePaused())//if game is not paused (if game is running) { elapsedSeconds += Time.deltaTime; if (PlayTime.TotalSeconds > SecondsToAdd && SecondsToAdd > 5)//everytime play time is longer than duration { //increase player speed playerMovement.IncreaseSpeed(.4f); if (obstacleSpawner.SpawnTime > 1.5) { //spawn obstacles faster obstacleSpawner.SpawnTime -= .2f; } //decrease the time of the seconds to add SecondsToAdd -= 2; } } }