public async void Init(GlobalTrickManager globalTrickManager)
        {
            _globalTrickManager = globalTrickManager;

            _logger.Debug($"Instantiated on {gameObject.name}");

            if (!_vrController)
            {
                _logger.Error("Controller not present");
                Cleanup();
                return;
            }

            if (IsLeftSaber)
            {
                _globalTrickManager.LeftSaberTrickManager = this;
            }
            else
            {
                _globalTrickManager.RightSaberTrickManager = this;
            }

            _movementController.Init(_vrController, this);

            _inputManager.Init(_saber.saberType, _vrController.GetField <VRControllersInputManager, VRController>("_vrControllersInputManager"));
            _inputManager.TrickActivated   += OnTrickActivated;
            _inputManager.TrickDeactivated += OnTrickDeactivated;

            var success = await SaberTrickModel.Init(_saber);

            if (success)
            {
                _logger.Info($"Got saber model");
            }
            else
            {
                _logger.Error("Couldn't get saber model");
                Cleanup();
                return;
            }

            _movementController.enabled = true;

            AddTrick <SpinTrick>();
            AddTrick <ThrowTrick>();

            _logger.Info($"{Tricks.Count} tricks initialized");

            if (_pauseController)
            {
                _pauseController.didResumeEvent += EndAllTricks;
            }

            _logger.Info("Trick Manager initialized");
        }
Example #2
0
        private void Awake()
        {
            Instance          = this;
            _slowmoStepAmount = PluginConfig.Instance.SlowmoStepAmount;

            //var scoreController = FindObjectsOfType<ScoreController>().FirstOrDefault();
            //BeatmapObjectManager = scoreController.GetField<BeatmapObjectManager, ScoreController>("_beatmapObjectManager");

            //BeatmapObjectManager.noteWasSpawnedEvent += OnNoteWasSpawned;
            //if (PluginConfig.Instance.DisableIfNotesOnScreen) StartCoroutine(NoteSpawnTimer());
        }
 private void Awake()
 {
     Instance          = this;
     _slowmoStepAmount = PluginConfig.Instance.SlowmoStepAmount;
     SaberClashChecker = FindObjectOfType <SaberClashChecker>();
 }