Exemplo n.º 1
0
        public void PlayMusic(MusicType musicType)
        {
            IMusicClip musicClip = _musicClips.FirstOrDefault(x => x.MusicType == musicType);

            if (musicClip == null)
            {
                _logger.LogError(LoggedFeature.Audio, $"Music Clip not found: {musicType}");
                return;
            }

            _musicSource.clip = musicClip.Clip;
            _musicSource.Play();
        }
        public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            if (_gameState == null)
            {
                _logger.LogError(LoggedFeature.GameState, $"Game State not found for state {_gameStateType}");
                return;
            }

            Debug.Log($"Exiting State: {_gameStateType}");
            _gameState.HandleStateExit();
            _gameState = null;
        }