示例#1
0
        void Awake()
        {
            output = GetComponentInChildren <PhysicalDataOutput>();

            shellTrigger = transform.Find("Shell").GetComponent <SimpleTrigger>();
            shellTrigger.TriggerEnter += OnShellTriggerEnter;
            shellTrigger.TriggerExit  += OnShellTriggerExit;

            Material shellMat = shellTrigger.transform.GetComponent <MeshRenderer>().material;

            baseShellEmissionGain = shellMat.GetFloat("_EmissionGain");
            baseShellColor        = shellMat.GetColor("_TintColor");

            foreignCores = new Dictionary <NoteOrb, List <NoteCore> >();

            coreContainer           = transform.Find("Cores");
            coreContainerLowerBound = coreContainer.Find("LowerBound");

            NoteCore initialCore = coreContainer.Find("InitialCore").GetComponent <NoteCore>();

            initialCoreScale = initialCore.transform.localScale;
            fullCoreScale    = new Vector3(FULL_ORB_CORE_RADIUS, FULL_ORB_CORE_RADIUS, FULL_ORB_CORE_RADIUS);

            noteCores = new List <NoteCore>();
            noteCores.Add(initialCore);

            collidingBatons = new HashSet <Baton>();

            selectedNotes = new List <int>();

            interactable = GetComponent <VRTK_InteractableObject>();
            interactable.InteractableObjectGrabbed   += OnGrabbed;
            interactable.InteractableObjectUngrabbed += OnUngrabbed;

            miniature = GetComponent <Miniature>();

            HMD = GameObject.FindGameObjectWithTag("Headset").transform;

            noteSelector            = FindObjectOfType <NoteSelector>();
            defaultSelfDestructArgs = new EventArgs();

            previewTriggerEventArgs          = new TriggerEventArgs();
            previewTriggerEventArgs.Velocity = 95;

            GetComponent <Triggerable>().TriggerStarted += OrbOn;
            GetComponent <Triggerable>().TriggerEnded   += OrbOff;
        }
示例#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));
        }