private IEnumerator WaitForEndOfMusic() { while (_audioSource.isPlaying) { yield return(sec); } RandomShapeGenerator.StopGeneration(); if (NetworkManager.Instance.YourID == 0) { _audioSource.clip = ScorePlayer1 > ScorePlayer2 ? _winClip : _looseClip; } else { _audioSource.clip = ScorePlayer1 > ScorePlayer2 ? _looseClip : _winClip; } _audioSource.Play(); ScorePlayer1 = 0; ScorePlayer2 = 0; IsRunning = false; }
private void StartGame() { Debug.Log("[GameBehaviour] GameBehaviour()."); _audioSource.clip = _musicClip; _audioSource.Play(); RandomShapeGenerator.StartGeneration(); UICentralManager.Instance.StartLookingScore(); StartCoroutine(WaitForEndOfMusic()); IsRunning = true; }
private void Awake() { _randomShapeShapeGenerator = FindObjectOfType <RandomShapeGenerator>(); _audioSource = GetComponent <AudioSource>(); }