// Use this for initialization void Start() { rigidBody = GetComponent <Rigidbody> (); currentTime = Time.time; MessageController.DisplayLives(); MessageController.RefreshScore(); PlayerLife = 3; }
// Update is called once per frame void Update() { if (GameState != GameStates.GameOver) { if (Beat1 && Time.time - startTime >= TimeToPlayNextBeat) { Beat1 = false; startTime = Time.time; audioSource.clip = BeatSound1; audioSource.Play(); } else if (!Beat1 && Time.time - startTime >= TimeToPlayNextBeat) { Beat1 = true; startTime = Time.time; audioSource.clip = BeatSound2; audioSource.Play(); } } if (GameState == GameStates.GameOn && Player.PlayerLife > 0) { if (AsteroidSpawnController.AsteroidCount() == 0) { StartNextLevel(); } } if (GameScore >= NextScoreForLife) { Player.PlayerLife++; MessageController.DisplayLives(); NextScoreForLife += 10000; } }