Exemplo n.º 1
0
 void Toss_InteractableObjectUngrabbed(object sender, VRTK.InteractableObjectEventArgs e)
 {
     // set the object's owner to be scene, which is 0, so that they dont get destroyed when the player leave the room
     toss.GetComponent <PhotonView> ().TransferOwnership(0);
     mycolor   = Color.white;
     spinSpeed = 60f;
 }
Exemplo n.º 2
0
 private void OnBookUsed(object sender, VRTK.InteractableObjectEventArgs e)
 {
     if (closed)
     {
         closed = false;
         frontRotator.isLocked = false;
     }
 }
Exemplo n.º 3
0
    public void OnUse(object interactingObject, VRTK.InteractableObjectEventArgs a)
    {
        if (anim.isPlaying)
        {
            return;
        }

        if (!playerUsable)
        {
            if (!isOpen)
            {
                if (chestLockedSound != null)
                {
                    AudioSource.PlayClipAtPoint(chestLockedSound, transform.position);
                }
                if (OnChestLocked != null)
                {
                    OnChestLocked();
                }
            }
            return;
        }

        if (isOpen)
        {
            if (chestCloseSound != null)
            {
                AudioSource.PlayClipAtPoint(chestCloseSound, transform.position);
            }
            if (OnChestClosed != null)
            {
                OnChestClosed();
            }
            anim.Play("woodenchest_large_close");
            isOpen = false;
            Invoke("DisableContents", 1f);
        }
        else
        {
            if (chestOpenSound != null)
            {
                AudioSource.PlayClipAtPoint(chestOpenSound, transform.position);
            }
            if (OnChestOpened != null)
            {
                OnChestOpened();
            }
            Debug.Log("Open chest!");
            anim.Play("woodenchest_large_open");
            isOpen = true;
            EnableContents();
            if (disableAfterOpen)
            {
                interactableObject.enabled = false;
                GetComponent <VRTK_OutlineObjectCopyHighlighter> ().enabled = false;
            }
        }
    }
Exemplo n.º 4
0
 public void OnTouch(object interactingObject, VRTK.InteractableObjectEventArgs a)
 {
     if (untouched)
     {
         DestroyAttentionObject();
         untouched = false;
     }
     if (conversationCanvas == null)
     {
         CreateCanvas();
     }
 }
        //this is called when the object is ungrabbed (was here before somehow)
        void InteractableObjectUngrabbed(object sender, VRTK.InteractableObjectEventArgs e)
        {
            Debug.Log("VRTK Waypoint UnGrabber Function called");


            //stop coroutine
            StopCoroutine(updateLine());

            //inform the reference drone that the flight path has been changed.
            waypointStatus     = prevWaypointStatus;
            prevWaypointStatus = WaypointStatus.GRABBED;

            // change the color to un grabbed
            this.GetComponent <MeshRenderer>().material = unpassedWaypoint;

            // Trigger UpdateWaypoints call for drone.
            referenceDrone.DronePathUpdated();
        }
 private void Interactable_InteractableObjectUngrabbed(object sender, VRTK.InteractableObjectEventArgs e)
 {
     isGrabbed = false;
     if (shouldUploadFeedback)
     {
         infoText.text        = "Uploading feedback...";
         shouldUploadFeedback = false;
         audioSource.clip     = confirmationClip;
         audioSource.Play();
         GetComponent <Renderer>().material = workingMaterial;
         var metadata = feedbackMetadataProvider.GetFeedbackMetadata();
         metadata.Add("mic-holding-time", (Time.time - micRecordingTime).ToString());
         feedbackManager.SaveFeedback(metadata);
     }
     else
     {
         infoText.text = "Grab me to\nrecord voice feedback";
     }
 }
Exemplo n.º 7
0
    private void DoObjectGrab(object sender, InteractableObjectEventArgs e)
    {
        if (e.interactingObject == controllers.left)
        {
            holdControl = controllers.left.GetComponent<VRTK_ControllerEvents>();
            stringControl = controllers.right.GetComponent<VRTK_ControllerEvents>();

            holdActions = controllers.left.GetComponent<VRTK_ControllerActions>();
            stringActions = controllers.right.GetComponent<VRTK_ControllerActions>();
        }
        else
        {
            stringControl = controllers.left.GetComponent<VRTK_ControllerEvents>();
            holdControl = controllers.right.GetComponent<VRTK_ControllerEvents>();

            stringActions = controllers.left.GetComponent<VRTK_ControllerActions>();
            holdActions = controllers.right.GetComponent<VRTK_ControllerActions>();
        }
        StartCoroutine("GetBaseRotation");
    }
Exemplo n.º 8
0
    public void OnUse(object interactingObject, VRTK.InteractableObjectEventArgs a)
    {
        Destroy(interactableObject);

        if (OnItemPickedUp != null)
        {
            OnItemPickedUp(itemName);
        }

        FindObjectOfType <QuestManager> ().CompleteQuest(quest_id);

        if (itemPickupSoundFX != null)
        {
            AudioSource.PlayClipAtPoint(itemPickupSoundFX, transform.position);
        }
        MakePickupText();

        Destroy(gameObject);
        if (exclamationMark != null)
        {
            Destroy(exclamationMark);
        }
    }
Exemplo n.º 9
0
 protected virtual void InteractableObjectUngrabbed(object sender, InteractableObjectEventArgs e)
 {
     leverRigidbody.angularDrag = releasedFriction;
 }
Exemplo n.º 10
0
 protected virtual void InteractableObjectGrabbed(object sender, InteractableObjectEventArgs e)
 {
     doorRigidbody.angularDrag = grabbedFriction;
 }
Exemplo n.º 11
0
 // Token: 0x06001452 RID: 5202 RVA: 0x00071935 File Offset: 0x0006FB35
 protected virtual void WheelInteractableObjectGrabbed(object sender, InteractableObjectEventArgs e)
 {
     this.wheelRigidbody.angularDrag = this.grabbedFriction;
     this.wheelHinge.useSpring       = false;
 }
Exemplo n.º 12
0
 protected override void InteractableObjectUngrabbed(object sender, InteractableObjectEventArgs e)
 {
     base.InteractableObjectUngrabbed(sender, e);
     isGrabbed = false;
 }
Exemplo n.º 13
0
 public override void OnInteractableObjectUntouched(InteractableObjectEventArgs e)
 {
     GetComponent <Renderer> ().material = oldMaterial;
     Debug.Log("Untouched");
     base.OnInteractableObjectUngrabbed(e);
 }
Exemplo n.º 14
0
 private void WheelInteractableObjectGrabbed(object sender, InteractableObjectEventArgs e)
 {
     wheelRigidbody.angularDrag = grabbedFriction;
     wheelHinge.useSpring       = false;
 }
Exemplo n.º 15
0
 private void InteractableObjectUngrabbed(object sender, InteractableObjectEventArgs e)
 {
     doorRigidbody.angularDrag = releasedFriction;
 }
        protected virtual void ObjectUnClicked(object sender, InteractableObjectEventArgs e)
        {
            base.DoUnClickButton(sender);
            isClicked = false;

            if ((hideAfterExecution || (collidingObjects.Count == 0 && menu.hideOnRelease)) && menu.executeOnUnclick)
            {
                ImmediatelyHideMenu(e);
            }
        }
Exemplo n.º 17
0
 void Toss_InteractableObjectGrabbed(object sender, VRTK.InteractableObjectEventArgs e)
 {
     toss.GetComponent <PhotonView> ().TransferOwnership(PhotonNetwork.player.ID);
     mycolor   = Color.blue;
     spinSpeed = 0f;
 }
Exemplo n.º 18
0
 public override void OnInteractableObjectGrabbed(InteractableObjectEventArgs e)
 {
     Debug.Log("Grabbed");
     evGrabbed.Invoke();
     base.OnInteractableObjectGrabbed(e);
 }
        protected virtual void ObjectClicked(object sender, InteractableObjectEventArgs e)
        {
            base.DoClickButton(sender);
            isClicked = true;

            if (hideAfterExecution && !menu.executeOnUnclick)
            {
                ImmediatelyHideMenu(e);
            }
        }
        protected virtual void ObjectUntouched(object sender, InteractableObjectEventArgs e)
        {
            collidingObjects.Remove(e.interactingObject);
            if (((!menu.executeOnUnclick || !isClicked) && menu.hideOnRelease) || (Object)sender == this)
            {
                base.DoHideMenu(hideAfterExecution, sender);

                interactingObjects.Remove(e.interactingObject);
                if (addMenuCollider && menuCollider != null)
                {
                    // In case there's any gap between the normal collider and the menuCollider, delay a bit. Cancelled if collider is re-entered
                    disableCoroutine = StartCoroutine(DelayedSetColliderEnabled(false, 0.25f, e));
                }
            }
        }
        private void SetColliderState(bool state, InteractableObjectEventArgs e)
        {
            if (addMenuCollider && menuCollider != null)
            {
                if (state)
                {
                    menuCollider.enabled = true;
                    menuCollider.center = desiredColliderCenter;
                }
                else
                {
                    bool should = true;
                    Collider[] colliders = eventsManager.GetComponents<Collider>();
                    Collider[] controllerColliders = e.interactingObject.GetComponent<VRTK_InteractTouch>().ControllerColliders();
                    foreach (var collider in colliders)
                    {
                        if (collider != menuCollider)
                        {
                            foreach (var controllerCollider in controllerColliders)
                            {
                                if (controllerCollider.bounds.Intersects(collider.bounds))
                                {
                                    should = false;
                                }
                            }
                        }
                    }

                    if (should)
                    {
                        menuCollider.center = new Vector3(100000000.0f, 100000000.0f, 100000000.0f); // This needs to be done to get OnTriggerExit() to fire, unfortunately
                        waitingToDisableCollider = true; // Need to give other things time to realize that they're not colliding with this anymore, so do it a couple FixedUpdates
                    }
                    else
                    {
                        menuCollider.enabled = false;
                    }
                }
            }
        }
 private void ImmediatelyHideMenu(InteractableObjectEventArgs e)
 {
     ObjectUntouched(this, e);
     if (disableCoroutine != null)
     {
         StopCoroutine(disableCoroutine);
     }
     SetColliderState(false, e); // Don't want to wait for this
 }
        IEnumerator DelayedSetColliderEnabled(bool enabled, float delay, InteractableObjectEventArgs e)
        {
            yield return new WaitForSeconds(delay);

            SetColliderState(enabled, e);

            StopCoroutine("delayedSetColliderEnabled");
        }
        protected virtual IEnumerator DelayedSetColliderEnabled(bool enabled, float delay, InteractableObjectEventArgs e)
        {
            yield return(new WaitForSeconds(delay));

            SetColliderState(enabled, e);

            StopCoroutine("delayedSetColliderEnabled");
        }
Exemplo n.º 25
0
 public void InteractableObjectGrabbed(object sender, VRTK.InteractableObjectEventArgs e)
 {
     Debug.Log("Grabe Object");
 }
        private void DoInteractableObjectIsUngrabbed(object sender, InteractableObjectEventArgs e)
        {
            isGrabbed = false;
            if (isShown)
            {
                HideMenuImmediate();
            }

            if (controllerEvents != null)
            {
                UnbindControllerEvents();
                controllerEvents = null;
            }
        }
        protected virtual void ObjectTouched(object sender, InteractableObjectEventArgs e)
        {
            base.DoShowMenu(CalculateAngle(e.interactingObject), sender);
            collidingObjects.Add(e.interactingObject);

            interactingObjects.Add(e.interactingObject);
            if (addMenuCollider && menuCollider != null)
            {
                SetColliderState(true, e);
                if (disableCoroutine != null)
                {
                    StopCoroutine(disableCoroutine);
                }
            }
        }
Exemplo n.º 28
0
 protected virtual void InteractableObjectUngrabbed(object sender, InteractableObjectEventArgs e)
 {
     regrabTimer = regrabDelay + Time.time;
 }
Exemplo n.º 29
0
 protected virtual void InteractableObjectUnused(object sender, InteractableObjectEventArgs e)
 {
     reuseTimer = reuseDelay + Time.time;
 }
 private void GenerateAndSpawnTilesAtController_InteractableObjectSnappedToDropZone(object sender, VRTK.InteractableObjectEventArgs e)
 {
     Invoke("SpawnTile", 0.5f);
 }
Exemplo n.º 31
0
 protected virtual void InteractableObjectTouched(object sender, InteractableObjectEventArgs e)
 {
     ManageTouchers(e.interactingObject, true);
     CheckGrab(e.interactingObject);
     CheckUse(e.interactingObject);
 }
 public virtual void OnInteractableObjectUsed(InteractableObjectEventArgs e)
 {
     if (InteractableObjectUsed != null)
         InteractableObjectUsed(this, e);
 }
 private void DoInteractableObjectIsGrabbed(object sender, InteractableObjectEventArgs e)
 {
     controllerEvents = e.interactingObject.GetComponentInParent<VRTK_ControllerEvents>();
     if (controllerEvents != null)
     {
         BindControllerEvents();
     }
     isGrabbed = true;
 }