private void RescaleSaberHitBox(Saber saber, float lengthMultiplier) { if (saber != null) { Transform topPos = saber.GetField <Transform, Saber>("_saberBladeTopTransform"); Transform bottomPos = saber.GetField <Transform, Saber>("_saberBladeBottomTransform"); topPos.localPosition = Vector3Extensions.Rescale(topPos.localPosition, 1.0f, 1.0f, lengthMultiplier); bottomPos.localPosition = Vector3Extensions.Rescale(bottomPos.localPosition, 1.0f, 1.0f, lengthMultiplier); } }
void ReplaceControllers() { if (!Config.Instance.SpectatorMode || Client.Instance.inRadioMode) { return; } audioTimeSync = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault(); _leftSaber = Resources.FindObjectsOfTypeAll <Saber>().First(x => x.saberType == SaberType.SaberB); _leftController = _leftSaber.GetField <VRController, Saber>("_vrController").gameObject.AddComponent <OnlineVRController>(); _leftSaber.SetField <Saber, VRController>("_vrController", _leftController); _rightSaber = Resources.FindObjectsOfTypeAll <Saber>().First(x => x.saberType == SaberType.SaberA); _rightController = _rightSaber.GetField <VRController, Saber>("_vrController").gameObject.AddComponent <OnlineVRController>(); _rightSaber.SetField <Saber, VRController>("_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!"); }
private void GetHitboxDefaultTransforms(Saber saber, out Transform saberTop, out Transform saberBot) { saberTop = saber.GetField <Transform, Saber>("_saberBladeTopTransform"); saberBot = saber.GetField <Transform, Saber>("_saberBladeBottomTransform"); }
private void SetHitboxDefaultPosition(Saber saber, out Transform saberTop, out Transform saberBot) { saberTop = saber.GetField <Transform, Saber>("_topPos"); saberBot = saber.GetField <Transform, Saber>("_bottomPos"); }