public void LoadGameSceneLoadedBehaviors() { if (InputManager == null) { InputManager = new GameObject(nameof(InputManager)).AddComponent <InputManager>(); } InputManager.BeginPolling(); if (SaberDeviceManager == null) { SaberDeviceManager = new GameObject(nameof(SaberDeviceManager)).AddComponent <SaberDeviceManager>(); } SaberDeviceManager.BeginGameCoreScene(); if (BeatSaberBehavior == null) { BeatSaberBehavior = new GameObject(nameof(BeatSaberBehavior)).AddComponent <BeatSaberBehavior>(); } BeatSaberBehavior.BeginGameCoreScene(); if (DarthMaulBehavior == null) { DarthMaulBehavior = new GameObject(nameof(DarthMaulBehavior)).AddComponent <DarthMaulBehavior>(); } DarthMaulBehavior.BeginGameCoreScene(); if (BeatSpearBehavior == null) { BeatSpearBehavior = new GameObject(nameof(BeatSpearBehavior)).AddComponent <BeatSpearBehavior>(); } BeatSpearBehavior.BeginGameCoreScene(); if (NunchakuBehavior == null) { NunchakuBehavior = new GameObject(nameof(NunchakuBehavior)).AddComponent <NunchakuBehavior>(); } NunchakuBehavior.BeginGameCoreScene(); if (FlailBehavior == null) { FlailBehavior = new GameObject(nameof(FlailBehavior)).AddComponent <BeatFlailBehavior>(); } FlailBehavior.BeginGameCoreScene(); if (GameModifiersBehavior == null) { GameModifiersBehavior = new GameObject(nameof(GameModifiersBehavior)).AddComponent <GameModifiersBehavior>(); } GameModifiersBehavior.BeginGameCoreScene(); }
/// <summary> /// Transform the left spear based on the controller or the tracker /// </summary> private void TransformForOneControllerSpear() { var config = Configuration.instance.ConfigurationData; // Get the spear pose and correct spear method SaberDeviceManager saberDeviceManager = BehaviorCatalog.instance.SaberDeviceManager; Action <Pose> setSpearPose = this.GetSpearPoseAction(); Pose spearPose = config.UseLeftSpear ? saberDeviceManager.GetLeftSaberPose(config.LeftSpearTracker) : saberDeviceManager.GetRightSaberPose(config.RightSpearTracker); // Check for reversing saber direction if (config.ReverseSpearDirection) { spearPose = spearPose.Reverse(); } setSpearPose(spearPose); }
private void Update() { var config = Configuration.instance.ConfigurationData; if (config.PlayMode != PlayMode.BeatSpear) { // Do nothing if we aren't playing Beat Spear or if we can't find the player controller return; } switch (config.SpearControllerCount) { case ControllerCountEnum.One: this.TransformForOneControllerSpear(); break; case ControllerCountEnum.Two: this.TransformForTwoControllerSpear(); break; default: // Do nothing break; } // Move the other saber away since there's a bug in the base game which makes it // able to cut bombs still SaberDeviceManager saberDeviceManager = BehaviorCatalog.instance.SaberDeviceManager; if (config.UseLeftSpear) { saberDeviceManager.SetRightSaberPose(hiddenPose); } else { saberDeviceManager.SetLeftSaberPose(hiddenPose); } }