Beispiel #1
0
        public void Collapse()
        {
            Flow    = 0;
            Flowing = false;

            collapsing = true;

            Plug plugA = A.GetComponentInActor <Plug>();
            Plug plugB = B.GetComponentInActor <Plug>();

            collapseStart = 0;
            collapseEnd   = path.Count - 1;

            if (plugA != null)
            {
                CordFollower followerA = plugA.GetComponent <CordFollower>();
                followerA.enabled = true;
                followerA.TeleportToPoint(0);
                followerA.SetTargetPoint(path.Count - 1);
                followerA.NextPointReached += OnStartPointConsumed;
                plugA.GetComponent <VRTK_InteractableObject>().isGrabbable = false;
            }

            if (plugB != null)
            {
                CordFollower followerB = plugB.GetComponent <CordFollower>();
                followerB.enabled = true;
                followerB.TeleportToPoint(path.Count - 1);
                followerB.SetTargetPoint(0);
                followerB.NextPointReached += OnEndPointConsumed;
                plugB.GetComponent <VRTK_InteractableObject>().isGrabbable = false;
            }
        }
Beispiel #2
0
        // Use this for initialization
        void Awake()
        {
            GetComponent <VRTK_InteractableObject>().InteractableObjectGrabbed   += OnGrabbed;
            GetComponent <VRTK_InteractableObject>().InteractableObjectUngrabbed += OnUngrabbed;

            GetComponent <VRTK_InteractableObject>().isGrabbable = false;

            cordFollower = GetComponent <CordFollower>();
        }