Beispiel #1
0
        void ReplaceControllers()
        {
            if (!Config.Instance.SpectatorMode || Client.Instance.inRadioMode)
            {
                return;
            }

            audioTimeSync = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault();

            _leftSaber      = Resources.FindObjectsOfTypeAll <Saber>().First(x => x.saberType == Saber.SaberType.SaberB);
            _leftController = _leftSaber.GetPrivateField <VRController>("_vrController").gameObject.AddComponent <OnlineVRController>();
            _leftSaber.SetPrivateField("_vrController", _leftController);

            _rightSaber      = Resources.FindObjectsOfTypeAll <Saber>().First(x => x.saberType == Saber.SaberType.SaberA);
            _rightController = _rightSaber.GetPrivateField <VRController>("_vrController").gameObject.AddComponent <OnlineVRController>();
            _rightSaber.SetPrivateField("_vrController", _rightController);

            Plugin.log.Info("Controllers replaced!");

            _scoreController = FindObjectOfType <ScoreController>();

#if DEBUG
            _scoreController.noteWasMissedEvent += _scoreController_noteWasMissedEvent;
            _scoreController.noteWasCutEvent    += _scoreController_noteWasCutEvent;
#endif

            Plugin.log.Info("Score controller found!");

            _energyCounter = FindObjectOfType <GameEnergyCounter>();

            Plugin.log.Info("Energy counter found!");
        }