Ejemplo n.º 1
0
 internal static bool Prefix(GorillaTagger __instance, ref float red, ref float green, ref float blue)
 {
     __instance.offlineVRRig.InitializeNoobMaterialLocal(red, green, blue);
     __instance.offlineVRRig.ChangeMaterialLocal(0);
     return(false);
 }
Ejemplo n.º 2
0
        static void Prefix(GorillaTagger __instance)
        {
            if (MyPatcher.muteSelf)
            {
                GorillaComputer.instance.pttType = "PUSH TO TALK";
                PhotonVoiceNetwork.Instance.PrimaryRecorder.TransmitEnabled = !MyPatcher.muteSelf;
                PhotonNetworkController.instance.GetComponent <Recorder>().TransmitEnabled = !MyPatcher.muteSelf;
                Debug.Log("Muted I think " + MyPatcher.muteSelf);
                Debug.Log("Muted I think 2 " + !MyPatcher.muteSelf);
            }
            else
            {
                GorillaComputer.instance.pttType = PlayerPrefs.GetString("pttType", "ALL CHAT");
            }

            if (MyPatcher.Spectate)
            {
                sensX = MyPatcher.sensX;
                sensY = MyPatcher.sensY;


                __instance.thirdPersonCamera.transform.SetParent(camParent.transform);

                float x = 0;
                float z = 0;
                float y = 0;

                if (MyPatcher.PlayerMover)
                {
                    camParent.transform.position = GorillaLocomotion.Player.Instance.transform.parent.position;
                }
                if (!(Gamepad.current is null))
                {
                    gamepad = Gamepad.current;

                    if (gamepad != null)
                    {
                        if (gamepad.leftStick.ReadValue().x > 0.1 || gamepad.leftStick.ReadValue().x < -0.1 || gamepad.leftStick.ReadValue().y > 0.1 || gamepad.leftStick.ReadValue().y < -0.1)
                        {
                            Vector2 left = gamepad.leftStick.ReadValue();
                            z = left.y;
                            x = left.x;
                            Free();
                        }

                        if (gamepad.rightStick.ReadValue().x > 0.1 || gamepad.rightStick.ReadValue().x < -0.1 || gamepad.rightStick.ReadValue().y > 0.1 || gamepad.rightStick.ReadValue().y < -0.1)
                        {
                            Vector2 right = gamepad.rightStick.ReadValue();
                            rotX += right.x * sensX;
                            rotY += right.y * sensY;
                            Free();
                        }



                        if (gamepad.rightShoulder.isPressed)
                        {
                            y = 1;
                            Free();
                        }
                        if (gamepad.leftShoulder.isPressed)
                        {
                            y = -1;
                            Free();
                        }
                    }
                }

                if (Keyboard.current.wKey.isPressed)
                {
                    z = 1;
                    Free();
                }
                if (Keyboard.current.cKey.isPressed)
                {
                    Free();
                }
                if (Keyboard.current.aKey.isPressed)
                {
                    x = -1;
                    Free();
                }
                if (Keyboard.current.sKey.isPressed)
                {
                    z = -1;
                    Free();
                }
                if (Keyboard.current.dKey.isPressed)
                {
                    x = 1;
                    Free();
                }
                if (Keyboard.current.eKey.isPressed)
                {
                    y = 1;
                    Free();
                }
                if (Keyboard.current.qKey.isPressed)
                {
                    y = -1;
                    Free();
                }

                if (Keyboard.current.leftArrowKey.isPressed)
                {
                    rotX -= 1 * sensX;
                    Free();
                }
                if (Keyboard.current.rightArrowKey.isPressed)
                {
                    rotX += 1 * sensX;
                    Free();
                }
                if (Keyboard.current.upArrowKey.isPressed)
                {
                    rotY += 1 * sensY;
                    Free();
                }
                if (Keyboard.current.downArrowKey.isPressed)
                {
                    rotY -= 1 * sensY;
                    Free();
                }
                if (Keyboard.current.f6Key.isPressed)
                {
                    if (keyP == false)
                    {
                        MyPatcher.ShowGui = !MyPatcher.ShowGui;
                    }
                    keyP = true;
                }
                else
                {
                    keyP = false;
                }
                if (Keyboard.current.digit1Key.isPressed)
                {
                    Current = 1;
                    FreeCam = false;
                }
                if (Keyboard.current.digit2Key.isPressed)
                {
                    Current = 2;
                    FreeCam = false;
                }
                if (Keyboard.current.digit3Key.isPressed)
                {
                    Current = 3;
                    FreeCam = false;
                }
                if (Keyboard.current.digit4Key.isPressed)
                {
                    Current = 4;
                    FreeCam = false;
                }
                if (Keyboard.current.digit5Key.isPressed)
                {
                    Current = 5;
                    FreeCam = false;
                }
                if (Keyboard.current.digit6Key.isPressed)
                {
                    Current = 6;
                    FreeCam = false;
                }
                if (Keyboard.current.digit7Key.isPressed)
                {
                    Current = 7;
                    FreeCam = false;
                }
                if (Keyboard.current.digit8Key.isPressed)
                {
                    Current = 8;
                    FreeCam = false;
                }


                if (FreeCam)
                {
                    rotY = Mathf.Clamp(rotY, -90, 90);

                    camParent.transform.rotation = Quaternion.Euler(-rotY, rotX, 0);

                    Vector3 dir = camParent.transform.right * x + camParent.transform.up * y + camParent.transform.forward * z;
                    if (!(gamepad is null))
                    {
                        if (gamepad.rightTrigger.isPressed)
                        {
                            camParent.transform.position += dir * 20 * Time.deltaTime;
                        }
                        if (gamepad.leftTrigger.isPressed)
                        {
                            camParent.transform.position += dir * 5 * Time.deltaTime;
                        }
                        else
                        {
                            camParent.transform.position += dir * 10 * Time.deltaTime;
                        }
                    }
                    else if (Keyboard.current.shiftKey.isPressed)
                    {
                        camParent.transform.position += dir * 20 * Time.deltaTime;
                    }
                    else
                    {
                        camParent.transform.position += dir * 10 * Time.deltaTime;
                    }

                    if (cb != null && !MyPatcher.PlayerMover)
                    {
                        cb.Follow = camParent.transform;
                    }

                    if (MyPatcher.PlayerMover)
                    {
                        GorillaLocomotion.Player.Instance.transform.parent.position = camParent.transform.position;
                        cb.Follow = GorillaLocomotion.Player.Instance.headCollider.transform;
                    }
                }
                else
                {
                    // Debug.Log(PhotonNetworkController.instance.currentGorillaParent.GetComponentsInChildren<VRRig>().Length);
                    if (MyPatcher.Spectate && FreeCam == false)
                    {
                        if (Current > GorillaParent.instance.GetComponentsInChildren <VRRig>().Length)
                        {
                            Current = GorillaParent.instance.GetComponentsInChildren <VRRig>().Length;
                        }
                        cb.Follow = GorillaParent.instance.GetComponentsInChildren <VRRig>()[Current - 1].head.rigTarget;
                    }
                }
            }