示例#1
0
        private void Start()
        {
            if (Instance != null)
            {
                Destroy(this);
                return;
            }
            Instance = this;

            VideoPlayer = gameObject.AddComponent <CustomVideoPlayer>();
            gameObject.AddComponent <LightController>();
            VideoPlayer.Player.frameReady          += FrameReady;
            VideoPlayer.Player.sendFrameReadyEvents = true;
            BSEvents.gameSceneActive            += GameSceneActive;
            BSEvents.gameSceneLoaded            += GameSceneLoaded;
            BSEvents.songPaused                 += PauseVideo;
            BSEvents.songUnpaused               += ResumeVideo;
            BSEvents.lateMenuSceneLoadedFresh   += OnMenuSceneLoadedFresh;
            BSEvents.menuSceneLoaded            += OnMenuSceneLoaded;
            VideoLoader.ConfigChanged           += OnConfigChanged;
            VideoPlayer.Player.prepareCompleted += OnPrepareComplete;
            Events.DifficultySelected           += DifficultySelected;
            DontDestroyOnLoad(gameObject);

            //The event handler is registered after the event is first fired, so we'll have to call the handler ourselves
            OnMenuSceneLoadedFresh(null);
        }
示例#2
0
        private void OnEnable()
        {
            _customVideoPlayer = PlaybackController.Instance.VideoPlayer;
            if (_lightGameObject == null)
            {
                CreateLight();
            }

            _customVideoPlayer.Player.frameReady           += ProcessFrame;
            _customVideoPlayer.stopped                     += VideoStopped;
            _customVideoPlayer.FadeController.EasingUpdate += OnFadeUpdate;
            Events.LevelSelected     += OnLevelSelected;
            BSEvents.gameSceneLoaded += OnGameSceneLoaded;
            BSEvents.menuSceneLoaded += OnMenuSceneLoaded;
        }