//////////////////////
    // INITIATILIZATION //
    //////////////////////
    void Start()
    {
        // Find an assign components and objects
        controllerManager         = GameObject.FindObjectOfType <SteamVR_ControllerManager>();
        leftControllerGameObject  = controllerManager.left;
        rightControllerGameObject = controllerManager.right;
        leftControllerTrackedObj  = leftControllerGameObject.GetComponent <SteamVR_TrackedObject>();
        rightControllerTrackedObj = rightControllerGameObject.GetComponent <SteamVR_TrackedObject>();

        armSwinger = GameObject.FindObjectOfType <ArmSwinger>();
    }
示例#2
0
    //////////////////////
    // INITIATILIZATION //
    //////////////////////
    void Start()
    {
        // Create a box collider for the headset if it doesn't already exist
        // The collider is a non-trigger
        headsetSphereCollider = GetComponent <SphereCollider>();
        if (!headsetSphereCollider)
        {
            headsetSphereCollider           = this.gameObject.AddComponent <SphereCollider>();
            headsetSphereCollider.isTrigger = false;
            headsetSphereCollider.radius    = headsetSphereColliderRadius;
        }
        else
        {
            if (headsetSphereCollider.isTrigger == true)
            {
                Debug.LogError("HeadsetCollider.Start():: There is already a sphere collider on your headset, but it is a trigger. Prevent Wall Clip will fail.");
            }

            Debug.LogWarning("HeadsetCollider.Start():: There is already a sphere collider on your headset.  Please ensure that it is an appropriate radius for Prevent Wall Clip to work.");
        }

        // Create a rigidbody for the headset if it doesn't already exit
        // The rigidbody is non-kinematic, and frozen for position and rotation
        // This was done to allow OnCollisionEnter's collision.point to work when detecting the normals of surfaces the headset runs into
        // If you have a better way to do this, please PLEASE submit it.  This solution makes me sad.
        headsetRigidbody = GetComponent <Rigidbody>();
        if (!headsetRigidbody)
        {
            headsetRigidbody             = this.gameObject.AddComponent <Rigidbody>();
            headsetRigidbody.isKinematic = false;
            headsetRigidbody.useGravity  = false;
            headsetRigidbody.constraints = RigidbodyConstraints.FreezeAll;
        }
        else
        {
            if (headsetRigidbody.isKinematic == true)
            {
                Debug.LogError("HeadsetCollider.Start():: There is already a RigidBody on your headset, but it is kinematic.  Prevent Wall Clip will fail.");
            }
            if (headsetRigidbody.constraints != RigidbodyConstraints.FreezeAll)
            {
                Debug.LogWarning("HeadsetCollider.Start():: There is already a RigidBody on your headset, but it does not have all constraints frozen.  Physics with the headset may be erratic.");
            }
        }

        // Initial collision position
        previousCollisionPosition = this.transform.position;
        previousCollisionRotation = this.transform.rotation;

        armSwinger = GameObject.FindObjectOfType <ArmSwinger>();
    }
示例#3
0
    //////////////////////
    // INITIATILIZATION //
    //////////////////////
    void Start()
    {
        startingColor = this.GetComponent <Image>().color;
        startingScale = this.transform.localScale;

        allSwingModeButtons = this.transform.parent.GetComponentsInChildren <SettingsButton>();

        armSwinger = GameObject.FindObjectOfType <ArmSwinger>();

        if (settingsDisplay.armSwingerSetting == SettingsDisplay.ArmSwingerSetting.swingMode &&
            armSwinger.armSwingMode == swingMode)
        {
            this.GetComponent <Image>().color = pushColor;
        }
    }
    // Use this for initialization
    void Start()
    {
        if (GameObject.Find("[VRTK]"))
        {
            player = GameObject.Find("[VRTK]").transform;

            player.position = gameObject.transform.position;
        }

        arm = GameObject.FindGameObjectWithTag("Player").GetComponent <ArmSwinger>();
        //arm.anglePreventionsPaused = true;
        //arm.playAreaHeightAdjustmentPaused = true;
        //arm.preventionsPaused = true;
        //arm.wallClipPreventionPaused = true;
        StartCoroutine(PutPlayer());
    }
示例#5
0
    public override void Setup(float startTime)
    {
        background.Show();

        topHand.visible(true);
        bottomPalm.visible(true);
        bottomWrist.visible(true);
        bottomHandFingers.visible(true);

        indexClosed.visible(true);
        indexOpen.visible(true);
        middleFingerOpen.visible(true);
        otherFingerOpen.visible(true);
        littleFingerOpen.visible(true);
        thumbOpen.visible(true);

        topHand.setScreenPosition(150, 66);

        bottomPalm.setScreenPosition(100, -10);
        bottomPalm.setDepth(0);

        bottomWrist.setScreenPosition(100, -10);
        bottomWrist.setDepth(0);

        bottomHandFingers.setScreenPosition(143, 82);
        bottomHandFingers.setDepth(3);

        wristPivot = bottomWrist.createPivotOnTopLeftCorner();
        armSwinger = new ArmSwinger(startTime, wristPivot);

        indexClosed.setScreenPosition(186, 52);
        indexClosed.setDepth(2);

        indexOpen.setScreenPosition(190, 9);
        middleFingerOpen.setScreenPosition(258, 22);
        otherFingerOpen.setScreenPosition(283, 42);
        littleFingerOpen.setScreenPosition(300, 70);
        thumbOpen.setScreenPosition(110, 80);

        openFingers = new Sprite[] { thumbOpen, indexOpen, middleFingerOpen, otherFingerOpen, littleFingerOpen };
        initializeOpenFingers(openFingers);
    }
    // Use this for initialization
    void Awake()
    {
        if (!lvlUpScreen)
        {
            lvlUpScreen = GameObject.Find("LevelUpScreen");
        }
        if (!vrInput)
        {
            vrInput = gameObject.GetComponent <VRUIinput>();
        }
        if (svrTrackedController)
        {
            svrTrackedController = gameObject.GetComponent <SteamVR_TrackedController>();
        }

        laserpointer     = gameObject.GetComponent <SteamVR_LaserPointer>();
        viveController   = gameObject.GetComponent <ViveController>();
        weaponControlVR  = gameObject.GetComponent <WeaponControlVR>();
        armswing         = GameObject.FindGameObjectWithTag("Player").GetComponent <ArmSwinger>();
        svrTrackedObject = gameObject.GetComponent <SteamVR_TrackedObject>();
        switchedtoGame   = true;
        popup            = GameObject.FindGameObjectWithTag("PopupDiag");
    }
示例#7
0
        public override void OnUpdate()
        {
            if (Input.GetKeyDown(KeyCode.Keypad1))
            {
                isActive = !isActive;
                if (isActive)
                {
                    CommandsShown = false;
                }
                else
                {
                    MelonModLogger.Log(": Keybinds disabled");
                }
            }

            if ((Time.time - LastTimeCheck2 > 25))
            {
                if (playerhead == null)
                {
                    if (Resources.FindObjectsOfTypeAll(Il2CppTypeOf <RNRHead> .Type).Length != 0)
                    {
                        playerhead = Resources.FindObjectsOfTypeAll(Il2CppTypeOf <RNRHead> .Type)[0].Cast <RNRHead>();
                        if (playerhead != null)
                        {
                            DebugLog("Found RNRHead Instance!");
                        }
                    }
                }


                if (playerhand == null)
                {
                    if (Resources.FindObjectsOfTypeAll(Il2CppTypeOf <RNRHand> .Type).Length != 0)
                    {
                        playerhand = Resources.FindObjectsOfTypeAll(Il2CppTypeOf <RNRHand> .Type)[0].Cast <RNRHand>();
                        if (playerhand != null)
                        {
                            DebugLog("Found RNRHand Instance!");
                        }
                    }
                }

                if (VrCollider == null)
                {
                    if (Resources.FindObjectsOfTypeAll(Il2CppTypeOf <HeadsetCollider> .Type).Length != 0)
                    {
                        VrCollider = Resources.FindObjectsOfTypeAll(Il2CppTypeOf <HeadsetCollider> .Type)[0].Cast <HeadsetCollider>();
                        if (VrCollider != null)
                        {
                            DebugLog("Found HeadsetCollider Instance!");
                        }
                    }
                }


                if (armsw == null)
                {
                    if (Resources.FindObjectsOfTypeAll(Il2CppTypeOf <ArmSwinger> .Type).Length != 0)
                    {
                        armsw = Resources.FindObjectsOfTypeAll(Il2CppTypeOf <ArmSwinger> .Type)[0].Cast <ArmSwinger>();
                        if (armsw != null)
                        {
                            DebugLog("Found ArmSwinger Instance!");
                        }
                    }
                }

                if (player == null)
                {
                    if (Resources.FindObjectsOfTypeAll(Il2CppTypeOf <RNRPlayer> .Type).Length != 0)
                    {
                        player = Resources.FindObjectsOfTypeAll(Il2CppTypeOf <RNRPlayer> .Type)[0].Cast <RNRPlayer>();
                        if (player != null)
                        {
                            DebugLog("Found RNRPlayer Instance!");
                        }
                    }
                }

                if (pdata == null)
                {
                    if (Resources.FindObjectsOfTypeAll(Il2CppTypeOf <PlayerData> .Type).Length != 0)
                    {
                        pdata = Resources.FindObjectsOfTypeAll(Il2CppTypeOf <PlayerData> .Type)[0].Cast <PlayerData>();
                        if (pdata != null)
                        {
                            DebugLog("Found PlayerData Instance!");
                        }
                    }
                }
                LastTimeCheck2 = Time.time;
            }
            if (!isActive)
            {
                return;
            }


            if (!CommandsShown)
            {
                MelonModLogger.Log(": Keybinds enabled");
                MelonModLogger.Log("D To Show Debug stuff!");
                MelonModLogger.Log("B To Kill all Headset Bounds!");
                MelonModLogger.Log("C To Unlock Everything!");
                MelonModLogger.Log("S To set 000 as Safe Code!");
                MelonModLogger.Log("G To Enable GOD Mode!");

                CommandsShown = true;
            }

            if (Input.GetKeyDown(KeyCode.S))
            {
                MelonModLogger.Log(": Generating Safe Code....");
                SetSafeCode();
            }


            if (Input.GetKeyDown(KeyCode.G))
            {
                isGodMode = !isGodMode;
                if (isGodMode)
                {
                    MelonModLogger.Log(": God Mode Enabled");
                    PlayerGod();
                }
                else
                {
                    MelonModLogger.Log(": God Mode Disabled");
                }
            }

            if (Input.GetKeyDown(KeyCode.B))
            {
                HeadsetColliderPatch = !HeadsetColliderPatch;
                if (HeadsetColliderPatch)
                {
                    MelonModLogger.Log(": Headset Bounds are Disabled!");
                    KillAllHeadsetBounds();
                }
                else
                {
                    MelonModLogger.Log(": Headset Bounds are Enabled!");
                }
            }


            if (Input.GetKeyDown(KeyCode.C))
            {
                UnlockAll();
                MelonModLogger.Log(": Unlocking Everything...");
            }

            if (Input.GetKeyDown(KeyCode.D))
            {
                isDebugMode = !isDebugMode;
                if (isDebugMode)
                {
                    MelonModLogger.Log(": Debug Info enabled");
                }
                else
                {
                    MelonModLogger.Log(": Debug Info disabled");
                }
            }

            if ((Time.time - LastTimeCheck > 15))
            {
                if (HeadsetColliderPatch)
                {
                    KillAllHeadsetBounds();
                }

                if (isGodMode)
                {
                    PlayerGod();
                }
                LastTimeCheck = Time.time;
            }
        }
示例#8
0
    public override void Setup(float startTime)
    {
        background.Show();

        topHand.visible(true);
        bottomPalm.visible(true);
        bottomWrist.visible(true);
        bottomHandFingers.visible(true);

        indexClosed.visible(true);
        indexOpen.visible(true);
        middleFingerOpen.visible(true);
        otherFingerOpen.visible(true);
        littleFingerOpen.visible(true);
        thumbOpen.visible(true);

        topHand.setScreenPosition(150, 66);

        bottomPalm.setScreenPosition(100, -10);
        bottomPalm.setDepth(0);

        bottomWrist.setScreenPosition(100, -10);
        bottomWrist.setDepth(0);

        bottomHandFingers.setScreenPosition(143, 82);
        bottomHandFingers.setDepth(3);

        wristPivot = bottomWrist.createPivotOnTopLeftCorner();
        armSwinger = new ArmSwinger(startTime, wristPivot);

        indexClosed.setScreenPosition(186, 52);
        indexClosed.setDepth(2);

        indexOpen.setScreenPosition(190, 9);
        middleFingerOpen.setScreenPosition(258, 22);
        otherFingerOpen.setScreenPosition(283, 42);
        littleFingerOpen.setScreenPosition(300, 70);
        thumbOpen.setScreenPosition(110, 80);

        openFingers = new Sprite[] { thumbOpen, indexOpen, middleFingerOpen, otherFingerOpen, littleFingerOpen };
        initializeOpenFingers(openFingers);
    }
    //////////////////////
    // INITIATILIZATION //
    //////////////////////
    void Start()
    {
        armSwinger = GameObject.FindObjectOfType <ArmSwinger>();

        displaySetting();
    }