// Update is called once per frame void Update() { robotList = (GameObject.FindGameObjectsWithTag("Robot")); robotAmount = robotList.Length; if (Input.GetKey(KeyCode.R)) { sceneScript.LoadLevel(sceneScript.level1); } if (Input.GetKey(KeyCode.Escape)) { sceneScript.LoadLevel(sceneScript.menu); } if (!audioSource.isPlaying) { if (sceneScript.curScene.buildIndex == sceneScript.level1) { audioSource.clip = gamePlayMusic; } else { audioSource.clip = menuMusic; } audioSource.Play(); } if (!timed) { deltatime += Time.deltaTime; } if (deltatime > robotSpawner.spawnRate * 2) { timed = true; if (robotAmount <= 0) { sceneScript.LoadLevel(sceneScript.menu); } } }