Exemplo n.º 1
0
        //-------------------------------------------------
        public bool IsEligibleForTeleport(NVRHand hand)
        {
            if (hand == null)
            {
                return(false);
            }

            if (!hand.gameObject.activeInHierarchy)
            {
                return(false);
            }

            if (hand.CurrentlyInteracting != null)
            {
                AllowTeleportWhileAttachedToHand allowTeleportWhileAttachedToHand = hand.CurrentlyInteracting.GetComponent <AllowTeleportWhileAttachedToHand>();

                if (allowTeleportWhileAttachedToHand != null && allowTeleportWhileAttachedToHand.teleportAllowed == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
 // Token: 0x0600220B RID: 8715 RVA: 0x000A9304 File Offset: 0x000A7504
 public bool IsEligibleForTeleport(Hand hand)
 {
     if (hand == null)
     {
         return(false);
     }
     if (!hand.gameObject.activeInHierarchy)
     {
         return(false);
     }
     if (hand.hoveringInteractable != null)
     {
         return(false);
     }
     if (hand.noSteamVRFallbackCamera == null)
     {
         if (hand.controller == null)
         {
             return(false);
         }
         if (hand.currentAttachedObject != null)
         {
             AllowTeleportWhileAttachedToHand component = hand.currentAttachedObject.GetComponent <AllowTeleportWhileAttachedToHand>();
             return(component != null && component.teleportAllowed);
         }
     }
     return(true);
 }
Exemplo n.º 3
0
        //-------------------------------------------------
        private void ShowPointer(NVRHand newPointerHand, NVRHand oldPointerHand)
        {
            if (!visible)
            {
                pointedAtTeleportMarker = null;
                pointerShowStartTime    = Time.time;
                visible    = true;
                meshFading = true;

                teleportPointerObject.SetActive(false);
                teleportArc.Show();

                foreach (TeleportMarkerBase teleportMarker in teleportMarkers)
                {
                    if (teleportMarker.markerActive && teleportMarker.ShouldActivate(FeetPositionEstimate()))
                    {
                        teleportMarker.gameObject.SetActive(true);
                        teleportMarker.Highlight(false);
                    }
                }

                startingFeetOffset = player.transform.position - FeetPositionEstimate();
                movedFeetFarEnough = false;

                if (onDeactivateObjectTransform.gameObject.activeSelf)
                {
                    onDeactivateObjectTransform.gameObject.SetActive(false);
                }
                onActivateObjectTransform.gameObject.SetActive(true);

                loopingAudioSource.clip = pointerLoopSound;
                loopingAudioSource.loop = true;
                loopingAudioSource.Play();
                loopingAudioSource.volume = 0.0f;
            }

            pointerHand = newPointerHand;

            if (visible && oldPointerHand != pointerHand)
            {
                PlayAudioClip(pointerAudioSource, pointerStartSound);
            }

            if (pointerHand)
            {
                pointerStartTransform = pointerHand.transform;

                if (pointerHand.CurrentlyInteracting != null)
                {
                    allowTeleportWhileAttached = pointerHand.CurrentlyInteracting.GetComponent <AllowTeleportWhileAttachedToHand>();
                }

                pointerAudioSource.transform.SetParent(pointerStartTransform);
                pointerAudioSource.transform.localPosition = Vector3.zero;

                loopingAudioSource.transform.SetParent(pointerStartTransform);
                loopingAudioSource.transform.localPosition = Vector3.zero;
            }
        }
Exemplo n.º 4
0
        //-------------------------------------------------
        private void Awake()
        {
            allowTeleport = GetComponent <AllowTeleportWhileAttachedToHand>();
            allowTeleport.teleportAllowed   = true;
            allowTeleport.overrideHoverLock = false;

            arrowList = new List <GameObject>();
        }
Exemplo n.º 5
0
        //-------------------------------------------------
        void Awake()
        {
            allowTeleport = GetComponent <AllowTeleportWhileAttachedToHand>();
            //allowTeleport.teleportAllowed = true;
            allowTeleport.overrideHoverLock = false;

            arrowList = new List <GameObject>();

            comboChecker = GameObject.Find("ComboCheck").GetComponent <Combo>();
        }
Exemplo n.º 6
0
        //-------------------------------------------------
        public bool IsEligibleForTeleport(Hand hand)
        {
            if (hand == null)
            {
                return(false);
            }

            if (!hand.gameObject.activeInHierarchy)
            {
                return(false);
            }

            if (hand.currentAttachedObject != null)
            {
                if (hand.currentAttachedObject.GetComponent <BoxingGloves>())
                {
                    return(true);
                }
            }

            if (hand.hoveringInteractable != null)
            {
                return(false);
            }

            if (hand.noSteamVRFallbackCamera == null)
            {
                if (hand.controller == null)
                {
                    return(false);
                }

                //Something is attached to the hand
                if (hand.currentAttachedObject != null)
                {
                    AllowTeleportWhileAttachedToHand allowTeleportWhileAttachedToHand = hand.currentAttachedObject.GetComponent <AllowTeleportWhileAttachedToHand>();

                    if (allowTeleportWhileAttachedToHand != null && allowTeleportWhileAttachedToHand.teleportAllowed == true)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            if (!hand.canTeleport)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 7
0
        //-------------------------------------------------
        void Awake()
        {
            allowTeleport = GetComponent <AllowTeleportWhileAttachedToHand>();
            allowTeleport.teleportAllowed   = false;
            allowTeleport.overrideHoverLock = false;
            quiver          = GameObject.Find("Quiver (Neck)");
            quiverSelection = GameObject.Find("Quiver Selection");
            quiverEnable    = GameObject.Find("Enable/Disable");
            noQuiver        = false;

            arrowList = new List <GameObject>();
        }
Exemplo n.º 8
0
        //-------------------------------------------------
        public bool IsEligibleForTeleport(Hand hand)
        {
            if (hand == null)
            {
                return(false);
            }

            if (!hand.gameObject.activeInHierarchy)
            {
                return(false);
            }

            if (hand.hoveringInteractable != null)
            {
                return(false);
            }

            //Only allow the player
            //if (hand.startingHandType == InteractionManager.Instance.paintHand)
            //{
            //    return false;
            //}

            if (hand.noSteamVRFallbackCamera == null)
            {
                if (hand.controller == null)
                {
                    return(false);
                }

                //Something is attached to the hand
                if (hand.currentAttachedObject != null)
                {
                    AllowTeleportWhileAttachedToHand allowTeleportWhileAttachedToHand = hand.currentAttachedObject.GetComponent <AllowTeleportWhileAttachedToHand>();

                    if (allowTeleportWhileAttachedToHand != null && allowTeleportWhileAttachedToHand.teleportAllowed == true)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Exemplo n.º 9
0
 bool IsEligibleForTeleport(Hand hand)
 {
     if (hand == null)
     {
         return(false);
     }
     if (hand.hoveringInteractable != null)
     {
         return(false);
     }
     if (!hand.isActive)
     {
         return(false);
     }
     //Something is attached to the hand
     if (hand.currentAttachedObject != null)
     {
         AllowTeleportWhileAttachedToHand allowTeleportWhileAttachedToHand = hand.currentAttachedObject.GetComponent <AllowTeleportWhileAttachedToHand>();
         return(allowTeleportWhileAttachedToHand != null && allowTeleportWhileAttachedToHand.teleportAllowed == true);
     }
     return(true);
 }
Exemplo n.º 10
0
        void ShowPointer( )
        {
            current_teleport_marker = null;
            pointerShowStartTime    = Time.time;
            visible    = true;
            meshFading = true;
            teleportPointerObject.SetActive(false);
            teleportArc.Show();
            pointerAudioSource.PlayClip(pointerStartSound);

            for (int i = 0; i < teleportMarkers.Length; i++)
            {
                if (teleportMarkers[i].markerActive && Vector3.Distance(teleportMarkers[i].transform.position, player.feetPositionGuess) > 1.0f)
                {
                    teleportMarkers[i].gameObject.SetActive(true);
                    teleportMarkers[i].Highlight(false);
                }
            }

            if (player.rightHand.currentAttachedObject != null)
            {
                allowTeleportWhileAttached = player.rightHand.currentAttachedObject.GetComponent <AllowTeleportWhileAttachedToHand>();
            }

            //Keep track of any existing hovering interactable on the hand
            originalHoverLockState       = player.rightHand.hoverLocked;
            originalHoveringInteractable = player.rightHand.hoveringInteractable;

            if (ShouldOverrideHoverLock())
            {
                player.rightHand.HoverLock(null);
            }

            pointerAudioSource.transform.SetParent(player.rightHand.transform);
            pointerAudioSource.transform.localPosition = Vector3.zero;
        }
Exemplo n.º 11
0
        //-------------------------------------------------
        private void ShowPointer(Hand newPointerHand, Hand oldPointerHand)
        {
            if (!visible)
            {
                pointedAtTeleportMarker = null;
                pointerShowStartTime    = Time.time;
                visible    = true;
                meshFading = true;

                teleportPointerObject.SetActive(false);
                teleportArc.Show();

                foreach (TeleportMarkerBase teleportMarker in teleportMarkers)
                {
                    if (teleportMarker.markerActive && teleportMarker.ShouldActivate(player.feetPositionGuess))
                    {
                        teleportMarker.gameObject.SetActive(true);
                        teleportMarker.Highlight(false);
                    }
                }

                startingFeetOffset = player.trackingOriginTransform.position - player.feetPositionGuess;
                movedFeetFarEnough = false;

                if (onDeactivateObjectTransform.gameObject.activeSelf)
                {
                    onDeactivateObjectTransform.gameObject.SetActive(false);
                }
                onActivateObjectTransform.gameObject.SetActive(true);

                loopingAudioSource.clip = pointerLoopSound;
                loopingAudioSource.loop = true;
                loopingAudioSource.Play();
                loopingAudioSource.volume = 0.0f;
            }


            if (oldPointerHand)
            {
                if (ShouldOverrideHoverLock())
                {
                    //Restore the original hovering interactable on the hand
                    if (originalHoverLockState == true)
                    {
                        oldPointerHand.HoverLock(originalHoveringInteractable);
                    }
                    else
                    {
                        oldPointerHand.HoverUnlock(null);
                    }
                }
            }

            pointerHand = newPointerHand;

            if (visible && oldPointerHand != pointerHand)
            {
                PlayAudioClip(pointerAudioSource, pointerStartSound);
            }

            if (pointerHand)
            {
                pointerStartTransform = GetPointerStartTransform(pointerHand);

                if (pointerHand.currentAttachedObject != null)
                {
                    allowTeleportWhileAttached = pointerHand.currentAttachedObject.GetComponent <AllowTeleportWhileAttachedToHand>();
                }

                //Keep track of any existing hovering interactable on the hand
                originalHoverLockState       = pointerHand.hoverLocked;
                originalHoveringInteractable = pointerHand.hoveringInteractable;

                if (ShouldOverrideHoverLock())
                {
                    pointerHand.HoverLock(null);
                }

                pointerAudioSource.transform.SetParent(pointerStartTransform);
                pointerAudioSource.transform.localPosition = Vector3.zero;

                loopingAudioSource.transform.SetParent(pointerStartTransform);
                loopingAudioSource.transform.localPosition = Vector3.zero;
            }
        }
Exemplo n.º 12
0
        //-------------------------------------------------
        public void ShowTeleportHint()
        {
            CancelTeleportHint();

            /* custom changes by Mars Motion */ if (gameObject.activeSelf)
            {
                /**/ hintCoroutine = StartCoroutine(TeleportHintCoroutine()); /* custom changes by Mars Motion */
            }                                                                 /**/
        }

        //-------------------------------------------------
        public void CancelTeleportHint()
        {
            if (hintCoroutine != null)
            {
                foreach (Hand hand in player.hands)
                {
                    ControllerButtonHints.HideTextHint(hand, EVRButtonId.k_EButton_SteamVR_Touchpad);
                }

                StopCoroutine(hintCoroutine);
                hintCoroutine = null;
            }

            CancelInvoke("ShowTeleportHint");
        }

        //-------------------------------------------------
        private IEnumerator TeleportHintCoroutine()
        {
            float prevBreakTime       = Time.time;
            float prevHapticPulseTime = Time.time;

            while (true)
            {
                bool pulsed = false;

                //Show the hint on each eligible hand
                foreach (Hand hand in player.hands)
                {
                    bool showHint      = IsEligibleForTeleport(hand);
                    bool isShowingHint = !string.IsNullOrEmpty(ControllerButtonHints.GetActiveHintText(hand, EVRButtonId.k_EButton_SteamVR_Touchpad));
                    if (showHint)
                    {
                        if (!isShowingHint)
                        {
                            ControllerButtonHints.ShowTextHint(hand, EVRButtonId.k_EButton_SteamVR_Touchpad, "Teleport");
                            prevBreakTime       = Time.time;
                            prevHapticPulseTime = Time.time;
                        }

                        if (Time.time > prevHapticPulseTime + 0.05f)
                        {
                            //Haptic pulse for a few seconds
                            pulsed = true;

                            hand.controller.TriggerHapticPulse(500);
                        }
                    }
                    else if (!showHint && isShowingHint)
                    {
                        ControllerButtonHints.HideTextHint(hand, EVRButtonId.k_EButton_SteamVR_Touchpad);
                    }
                }

                if (Time.time > prevBreakTime + 3.0f)
                {
                    //Take a break for a few seconds
                    yield return(new WaitForSeconds(3.0f));

                    prevBreakTime = Time.time;
                }

                if (pulsed)
                {
                    prevHapticPulseTime = Time.time;
                }

                yield return(null);
            }
        }

        //-------------------------------------------------
        public bool IsEligibleForTeleport(Hand hand)
        {
            /* custom changes by Mars Motion */
            Hand.HandType handType = hand.GuessCurrentHandType();

            if (handType == Hand.HandType.Left)
            {
                if (!Teleporter.left || !Teleporter.left.enabled || !Teleporter.left.gameObject || !Teleporter.left.gameObject.activeSelf || !Teleporter.left.locomotionDependencies.areMet())
                {
                    return(false);
                }
            }
            else
            {
                if (!Teleporter.right || !Teleporter.right.enabled || !Teleporter.right.gameObject || !Teleporter.right.gameObject.activeSelf || !Teleporter.right.locomotionDependencies.areMet())
                {
                    return(false);
                }
            }

            if (!Teleportation.enabledLocomotion())
            {
                return(false);
            }

            /**/ if (hand == null)
            {
                return(false);
            }

            if (!hand.gameObject.activeInHierarchy)
            {
                return(false);
            }

            if (hand.hoveringInteractable != null)
            {
                return(false);
            }

            if (hand.noSteamVRFallbackCamera == null)
            {
                if (hand.controller == null)
                {
                    return(false);
                }

                //Something is attached to the hand
                if (hand.currentAttachedObject != null)
                {
                    AllowTeleportWhileAttachedToHand allowTeleportWhileAttachedToHand = hand.currentAttachedObject.GetComponent <AllowTeleportWhileAttachedToHand>();

                    if (allowTeleportWhileAttachedToHand != null && allowTeleportWhileAttachedToHand.teleportAllowed == true)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Exemplo n.º 13
0
        //-------------------------------------------------
        private void ShowPointer(Hand newPointerHand, Hand oldPointerHand)
        {
            if (!visible)
            {
                pointedAtTeleportMarker = null;
                pointerShowStartTime    = Time.time;
                visible    = true;
                meshFading = true;

                teleportPointerObject.SetActive(false);
                teleportArc.Show();

                //MJ20170525 Never disabling teleportPoints for them to be able to detect collision with vision
                foreach (TeleportMarkerBase teleportMarker in teleportMarkers)
                {
                    if (teleportMarker.markerActive && teleportMarker.ShouldActivate(player.feetPositionGuess))
                    {
                        //teleportMarker.gameObject.SetActive( true );
                        teleportMarker.Highlight(false);
//						//MJ20170526 Necessary not to have alpha back to maximum temporarily ---------------
//						individualFullTintAlpha = teleportMarker.gameObject.transform.Find ("teleport_marker_mesh").GetComponent<TeleportVisionController> ().fullTintAlpha;
//						individualMeshAlphaPercent = teleportMarker.gameObject.transform.Find ("teleport_marker_mesh").GetComponent<TeleportVisionController> ().meshAlphaPercent;
//						teleportMarker.SetAlpha( individualFullTintAlpha * individualMeshAlphaPercent, individualMeshAlphaPercent );
                    }
                }

                startingFeetOffset = player.trackingOriginTransform.position - player.feetPositionGuess;
                movedFeetFarEnough = false;

                if (onDeactivateObjectTransform.gameObject.activeSelf)
                {
                    onDeactivateObjectTransform.gameObject.SetActive(false);
                }
                onActivateObjectTransform.gameObject.SetActive(true);

                loopingAudioSource.clip = pointerLoopSound;
                loopingAudioSource.loop = true;
                loopingAudioSource.Play();
                loopingAudioSource.volume = 0.0f;
            }


            if (oldPointerHand)
            {
                if (ShouldOverrideHoverLock())
                {
                    //Restore the original hovering interactable on the hand
                    if (originalHoverLockState == true)
                    {
                        oldPointerHand.HoverLock(originalHoveringInteractable);
                    }
                    else
                    {
                        oldPointerHand.HoverUnlock(null);
                    }
                }
            }

            pointerHand = newPointerHand;

            if (visible && oldPointerHand != pointerHand)
            {
                PlayAudioClip(pointerAudioSource, pointerStartSound);
            }

            if (pointerHand)
            {
                pointerStartTransform = GetPointerStartTransform(pointerHand);

                if (pointerHand.currentAttachedObject != null)
                {
                    allowTeleportWhileAttached = pointerHand.currentAttachedObject.GetComponent <AllowTeleportWhileAttachedToHand>();
                }

                //Keep track of any existing hovering interactable on the hand
                originalHoverLockState       = pointerHand.hoverLocked;
                originalHoveringInteractable = pointerHand.hoveringInteractable;

                if (ShouldOverrideHoverLock())
                {
                    pointerHand.HoverLock(null);
                }

                pointerAudioSource.transform.SetParent(pointerStartTransform);
                pointerAudioSource.transform.localPosition = Vector3.zero;

                loopingAudioSource.transform.SetParent(pointerStartTransform);
                loopingAudioSource.transform.localPosition = Vector3.zero;
            }
        }