Exemple #1
0
 public void CanStore(UnityAction onFailed, Socketable socketable, Socket socket)
 {
     //filter out what can and can't be socketed
     if (AllowedIds != null && AllowedIds.Length > 0)
     {
         var type = socketable.GetComponent <SocketableType>();
         if (type == null || HashedString.DoNotContain(AllowedIds, type.TypeName.Hash))
         {
             //let the inventory know that things are not well
             onFailed();
             return;
         }
     }
 }
Exemple #2
0
    private void OnTriggerEnter(Collider other)
    {
        // Try to find a socketable
        socketable = other.GetComponent <Socketable>();

        // If there isn't one, exit the method
        if (socketable == null)
        {
            return;
        }

        // If this isn't a type we accept, exit the method
        if (socketable.Type != acceptedSocketableType)
        {
            return;
        }

        // find the grabbable
        OVRGrabbable grabbable = other.GetComponent <OVRGrabbable>();

        if (grabbable != null && grabbable.isGrabbed)
        {
            // Whatever this grabbable is grabbed by
            // force it to release this grabbable
            grabbable.grabbedBy.ForceRelease(grabbable);
        }

        meshRenderer.enabled = false;
        socketable.GetComponent <Rigidbody>().isKinematic = true;

        if (doTween)
        {
            StartCoroutine(MoveIntoPlace(socketable.transform, duration));
        }
        else
        {
            socketable.transform.position = this.transform.position;
            socketable.transform.rotation = this.transform.rotation;
        }
    }