Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 3
0
 public void Play(ISoundPlayer player, string file)
 {
     player.LoadSound(file);
     player.PlaySound();
 }
Ejemplo n.º 4
0
 public void PlaySound(ISound sound)
 {
     soundPlayer.PlaySound(sound);
 }
Ejemplo n.º 5
0
 private async void PlaySound()
 {
     await _soundPlayer.PlaySound();
 }