protected override async void OnShow() { base.OnShow(); _soundPlayer.PlaySound(winSound); _playerGameCamera.gameObject.SetActive(true); var dir = (_playerGameCamera.transform.position - _gameManager.Tower.transform.position).normalized; var pos = _playerGameCamera.transform.position + dir * _gameData.cameraDistanceOnWin; _cameraTween = _playerGameCamera.transform.DOMove(pos, _gameData.cameraMoveDurationOnWin); _cameraTween.onComplete += () => _cameraTween = null; //Spawn win effect for each scale in the sequence foreach (var scale in _gameData.winEffectScalingSequence) { //Wait await UniTask.Delay(TimeSpan.FromSeconds(_gameData.winEffectTimeBetweenEach)); if (_stopWinEffect) { break; } var effect = Instantiate(_gameData.winEffect); effect.transform.position = _gameManager.Tower.transform.position; effect.transform.localScale = Vector3.one * scale; //Vibrate _hapticManager.Vibrate(); } }
protected override void OnShow() { base.OnShow(); levelFailedAnimation.Play("LevelFailed"); _soundPlayer.PlaySound(gameOverSound); }
public void Play(ISoundPlayer player, string file) { player.LoadSound(file); player.PlaySound(); }
public void PlaySound(ISound sound) { soundPlayer.PlaySound(sound); }
private async void PlaySound() { await _soundPlayer.PlaySound(); }