AudioSource voiceSource;                             //Reference to the generated voice Audio Source


    void Awake()
    {
        //Destroy the music of the menus
        GameObject musicMenu = GameObject.Find("MusicMenu");

        if (musicMenu != null)
        {
            Destroy(musicMenu);
        }

        //If an AudioLevelManager exists and it is not this...
        if (Instance != null && Instance != this)
        {
            Debug.LogError("Error with AudioLevelManager script components, 2 instances " + this);
            //...destroy this and exit. There can be only one AudioLevelManager
            Destroy(gameObject);
            return;
        }

        //This is the Instance AudioLevelManager, we use it for use the class's methods.
        Instance = this;

        //Generate the Audio Source "channels" for our game's audio
        musicSource         = gameObject.AddComponent <AudioSource>() as AudioSource;
        effectSource        = gameObject.AddComponent <AudioSource>() as AudioSource;
        playerSisterSource  = gameObject.AddComponent <AudioSource>() as AudioSource;
        playerBrotherSource = gameObject.AddComponent <AudioSource>() as AudioSource;
        voiceSource         = gameObject.AddComponent <AudioSource>() as AudioSource;

        //Assign each audio source to its respective mixer group so that it is
        //routed and controlled by the audio mixer
        musicSource.outputAudioMixerGroup         = musicGroup;
        effectSource.outputAudioMixerGroup        = effectGroup;
        playerSisterSource.outputAudioMixerGroup  = playerGroup;
        playerBrotherSource.outputAudioMixerGroup = playerGroup;
        voiceSource.outputAudioMixerGroup         = voiceGroup;

        //Being playing the game audio
        StartLevelAudio();
    }
Exemplo n.º 2
0
        private void InitLevelManager()
        {
            var output = SelectedOutput;

            if (output != null)
            {
                switch (output.Provider)
                {
                case DeviceProvider.Wasapi:
                    LevelManager = new AudioOutLevelManager(output.MMDevice);
                    break;

                default:
                    LevelManager = null;
                    break;
                }
            }
            else
            {
                LevelManager = null;
            }
        }
Exemplo n.º 3
0
 void Start()
 {
     Instance = this;
 }
Exemplo n.º 4
0
 void Start()
 {
     Instance = this;
 }