Ejemplo n.º 1
0
        private void PlayNextSplashScreen()
        {
            if (_currentSplashScreen >= _splashScreens.Length)
            {
                SceneManager.LoadScene(_mainSceneName);
                return;
            }

            VideoPlayer.EventHandler eventHandler = null;
            eventHandler = vp => {
                _videoPlayer.loopPointReached -= eventHandler;

                _currentSplashScreen++;
                PlayNextSplashScreen();
            };

            SplashScreenConfig config = _splashScreens[_currentSplashScreen];

            _videoPlayer.clip = config.videoClip;

            // config the volume for each track
            _videoPlayer.SetDirectAudioVolume(0, 1.0f);
            for (ushort i = 0; i < config.volume.Length; ++i)
            {
                _videoPlayer.SetDirectAudioVolume(i, config.volume[i]);
            }

            _videoPlayer.loopPointReached += eventHandler;
            _videoPlayer.Play();
        }
Ejemplo n.º 2
0
        private void PlayNextSplashScreen()
        {
            if (_currentSplashScreen >= _splashScreens.Length)
            {
                Debug.Log($"Loading main scene '{_mainSceneName}'...");
                SceneManager.LoadScene(_mainSceneName);
                return;
            }

            SplashScreenConfig config = _splashScreens[_currentSplashScreen];

            Debug.Log($"Playing splash screen {config.videoClip.name}");

            _videoPlayer.clip = config.videoClip;

            // config the volume for each track
            _videoPlayer.SetDirectAudioVolume(0, 1.0f);
            for (ushort i = 0; i < config.volume.Length; ++i)
            {
                _videoPlayer.SetDirectAudioVolume(i, config.volume[i]);
            }

            void EventHandler(VideoPlayer vp)
            {
                _videoPlayer.loopPointReached -= EventHandler;

                _currentSplashScreen++;
                PlayNextSplashScreen();
            }

            _videoPlayer.loopPointReached += EventHandler;
            _videoPlayer.Play();
        }
Ejemplo n.º 3
0
        private void PlayNextSplashScreen()
        {
            if (_currentSplashScreen >= _splashScreens.Length)
            {
                Debug.Log($"Loading main scene '{_mainSceneName}'...");
                SceneManager.LoadScene(_mainSceneName);
                return;
            }

            SplashScreenConfig config = _splashScreens[_currentSplashScreen];

            Debug.Log($"Playing splash screen {config.videoClip.name}");

            _videoPlayer.clip = config.videoClip;

            // config the volume for each track
            _videoPlayer.SetDirectAudioVolume(0, 1.0f);
            for (ushort i = 0; i < config.volume.Length && i < _videoPlayer.audioTrackCount; ++i)
            {
                _videoPlayer.SetDirectAudioVolume(i, config.volume[i]);
            }

            // prepare the clip
            _videoPlayer.prepareCompleted += PrepareCompletedEventHandler;
            _videoPlayer.Prepare();
        }