Exemplo n.º 1
0
        void Awake()
        {
            input = GetComponentInChildren <PhysicalDataInput>();

            Controller.SetController(this);

            GetComponent <VRTK_InteractableObject>().InteractableObjectUngrabbed += OnUngrabbed;
            deviceBrowserObject = FindObjectOfType <DeviceBrowserObject>();
            oscEventDispatcher  = FindObjectOfType <OSCEventDispatcher>();
        }
Exemplo n.º 2
0
        ConnectedDataEndpoints GetDataEndpointsConnectedByHandle()
        {
            bool branchFlowsIntoJunction = branchNode.Cord.EndNode.Equals(transform) ? branchNode.Cord.Flow > 0 : branchNode.Cord.Flow < 0;

            HashSet <PhysicalDataEndpoint> receptaclesConnectedToBranch   = branchNode.Cord.GetConnectedEndpoints(branchFlowsIntoJunction, transform);
            HashSet <PhysicalDataEndpoint> receptaclesConnectedToJunction = GetDownstreamJunctionNode(!branchFlowsIntoJunction).Cord.GetConnectedEndpoints(!branchFlowsIntoJunction, transform);

            HashSet <IPhysicalDataInput> connectedInputs = new HashSet <IPhysicalDataInput>();
            List <PhysicalDataOutput>    outputs         = new List <PhysicalDataOutput>();

            foreach (PhysicalDataEndpoint receptacle in receptaclesConnectedToBranch)
            {
                PhysicalDataOutput output = receptacle.GetComponent <PhysicalDataOutput>();
                if (output != null)
                {
                    outputs.Add(output);
                }
                else
                {
                    PhysicalDataInput input = receptacle.GetComponent <PhysicalDataInput>();
                    if (input != null)
                    {
                        connectedInputs.UnionWith(input.GetConnectedInputs());
                    }
                }
            }

            foreach (PhysicalDataEndpoint receptacle in receptaclesConnectedToJunction)
            {
                PhysicalDataOutput output = receptacle.GetComponent <PhysicalDataOutput>();
                if (output != null)
                {
                    outputs.Add(output);
                }
                else
                {
                    PhysicalDataInput input = receptacle.GetComponent <PhysicalDataInput>();
                    if (input != null)
                    {
                        connectedInputs.UnionWith(input.GetConnectedInputs());
                    }
                }
            }

            return(new ConnectedDataEndpoints(connectedInputs, outputs));
        }