Exemplo n.º 1
0
        static void Postfix(Vector3SO ____roomCenter, FloatSO ____roomRotation, MethodBase __originalMethod)
        {
            if (____roomCenter == null)
            {
                position = Vector3.zero;
            }
            else
            {
                position = ____roomCenter;
            }

            if (____roomRotation == null)
            {
                eulerAngles = Vector3.zero;
            }
            else
            {
                eulerAngles = new Vector3(0, ____roomRotation, 0);
            }
            rotation = Quaternion.Euler(eulerAngles);

#if DEBUG
            Plugin.Log.Warn("HookRoomAdjust.Postfix! " + __originalMethod.Name);
            Console.WriteLine("pos {0}, rot {1}", position, rotation);
#endif
        }
        internal static bool ImportFromGame()
        {
            // Get reference to MainSettingsModelSO
            MainSettingsModelSO mainSettings = Resources.FindObjectsOfTypeAll <MainSettingsModelSO>().FirstOrDefault();

            if (mainSettings == null)
            {
                Logger.log.Error("ImportFromGame: Unable to get a handle on MainSettingsModelSO. Exiting...");
                return(false);
            }

            // Check for position/rotation settings
            if (mainSettings.controllerPosition == null)
            {
                Logger.log.Error("ImportFromGame: Settings for controller position not found. Exiting...");
                return(false);
            }

            if (mainSettings.controllerRotation == null)
            {
                Logger.log.Error("ImportFromGame: Settings for controller rotation not found. Exiting...");
                return(false);
            }

            Vector3SO ctrlPos = mainSettings.controllerPosition;
            Vector3SO ctrlRot = mainSettings.controllerRotation;

            Configuration.GripCfg.PosLeft = new Int3()
            {
                x = -(int)ctrlPos.value.x * 1000,
                y = (int)ctrlPos.value.y * 1000,
                z = (int)ctrlPos.value.z * 1000
            };

            Configuration.GripCfg.RotLeft = new Int3()
            {
                x = (int)ctrlRot.value.x,
                y = -(int)ctrlRot.value.y,
                z = (int)ctrlRot.value.z
            };

            Configuration.GripCfg.PosRight = new Int3()
            {
                x = -(int)ctrlPos.value.x * 1000,
                y = (int)ctrlPos.value.y * 1000,
                z = (int)ctrlPos.value.z * 1000
            };

            Configuration.GripCfg.RotRight = new Int3()
            {
                x = (int)ctrlRot.value.x,
                y = -(int)ctrlRot.value.y,
                z = (int)ctrlRot.value.z
            };

            return(true);
        }
Exemplo n.º 3
0
 public ControllerOffset(Vector3SO positionOffset, Vector3SO rotationOffset)
 {
     positionX = positionOffset.value.x;
     positionY = positionOffset.value.y;
     positionZ = positionOffset.value.z;
     rotationX = rotationOffset.value.x;
     rotationY = rotationOffset.value.y;
     rotationZ = rotationOffset.value.z;
 }
Exemplo n.º 4
0
 public IEnumerator DoTheMove(Vector3SO finalPosition)
 {
     startingPosition = transform.position;
     percentTraveled  = 0f;
     while (!_finished)
     {
         percentTraveled   += Time.deltaTime / timeToTravel;
         transform.position = Vector3.Lerp(startingPosition, finalPosition.Position, percentTraveled);
         if (transform.position == finalPosition.Position)
         {
             _finished = true;
         }
         yield return(null);
     }
     _finished = false;
 }
Exemplo n.º 5
0
 public ControllerOffsetPresetsModalController([InjectOptional] SaberManager saberManager, [InjectOptional] MainSettingsMenuViewController mainSettingsMenuViewController)
 {
     if (saberManager != null)
     {
         VRController leftController = saberManager.leftSaber.GetComponentInParent <VRController>();
         VRControllersValueSOOffsets vrControllerTransformOffset = (VRControllersValueSOOffsets)Accessors.VRControllerTransformOffsetAccessor(ref leftController);
         positionOffset = Accessors.PositionOffsetAccessor(ref vrControllerTransformOffset);
         rotationOffset = Accessors.RotationOffsetAccessor(ref vrControllerTransformOffset);
     }
     else if (mainSettingsMenuViewController != null)
     {
         SettingsSubMenuInfo[] settingsSubMenuInfos = Accessors.SettingsSubMenuInfoAccessor(ref mainSettingsMenuViewController);
         foreach (var settingSubMenuInfo in settingsSubMenuInfos)
         {
             if (settingSubMenuInfo.viewController is ControllersTransformSettingsViewController controllersTransformSettingsViewController)
             {
                 positionOffset = Accessors.ControllerPositionAccessor(ref controllersTransformSettingsViewController);
                 rotationOffset = Accessors.ControllerRotationAccessor(ref controllersTransformSettingsViewController);
                 break;
             }
         }
     }
 }
Exemplo n.º 6
0
        internal static bool ImportFromGame()
        {
            // Get reference to MainSettingsModelSO
            MainSettingsModelSO mainSettings = Resources.FindObjectsOfTypeAll <MainSettingsModelSO>().FirstOrDefault();

            if (mainSettings == null)
            {
                Logger.log.Error("ImportFromGame: Unable to get a handle on MainSettingsModelSO. Exiting...");
                return(false);
            }

            // Check for position/rotation settings
            if (mainSettings.controllerPosition == null)
            {
                Logger.log.Error("ImportFromGame: Settings for controller position not found. Exiting...");
                return(false);
            }

            if (mainSettings.controllerRotation == null)
            {
                Logger.log.Error("ImportFromGame: Settings for controller rotation not found. Exiting...");
                return(false);
            }

            Vector3SO gameCtrlPosSO = mainSettings.controllerPosition;
            Vector3SO gameCtrlRotSO = mainSettings.controllerRotation;

            Vector3 ctrlPos = new Vector3(gameCtrlPosSO.value.x, gameCtrlPosSO.value.y, gameCtrlPosSO.value.z);
            Vector3 ctrlRot = new Vector3(gameCtrlRotSO.value.x, gameCtrlRotSO.value.y, gameCtrlRotSO.value.z);

            Configuration.GripCfg.PosLeft = new Int3()
            {
                x = -(int)Math.Round(ctrlPos.x * 1000, MidpointRounding.AwayFromZero),
                y = (int)Math.Round(ctrlPos.y * 1000, MidpointRounding.AwayFromZero),
                z = (int)Math.Round(ctrlPos.z * 1000, MidpointRounding.AwayFromZero)
            };

            Configuration.GripCfg.RotLeft = new Int3()
            {
                x = (int)Math.Round(ctrlRot.x, MidpointRounding.AwayFromZero),
                y = -(int)Math.Round(ctrlRot.y, MidpointRounding.AwayFromZero),
                z = (int)Math.Round(ctrlRot.z, MidpointRounding.AwayFromZero)
            };

            Configuration.GripCfg.PosRight = new Int3()
            {
                x = (int)Math.Round(ctrlPos.x * 1000, MidpointRounding.AwayFromZero),
                y = (int)Math.Round(ctrlPos.y * 1000, MidpointRounding.AwayFromZero),
                z = (int)Math.Round(ctrlPos.z * 1000, MidpointRounding.AwayFromZero)
            };

            Configuration.GripCfg.RotRight = new Int3()
            {
                x = (int)Math.Round(ctrlRot.x, MidpointRounding.AwayFromZero),
                y = (int)Math.Round(ctrlRot.y, MidpointRounding.AwayFromZero),
                z = (int)Math.Round(ctrlRot.z, MidpointRounding.AwayFromZero)
            };

            Configuration.Grip.UseBaseGameAdjustmentMode = true;

            return(true);
        }
Exemplo n.º 7
0
 public void MoveToFinalPosition(Vector3SO finalPosition)
 {
     StartCoroutine(DoTheMove(finalPosition));
 }
Exemplo n.º 8
0
 public void Input(Vector3SO data)
 {
     Input(data.value);
 }
Exemplo n.º 9
0
 public void UpdateData(Vector3SO dataObj)
 {
     data = dataObj.data;
 }
Exemplo n.º 10
0
 public void SetDestination(Vector3SO loc)
 {
     agent.destination = loc.data;
 }
Exemplo n.º 11
0
 public void InputDirection(Vector3SO value)
 {
     InputDirection(value.value);
 }
 public void Accelerate(Vector3SO data)
 {
     Accelerate(data.value);
 }