Ejemplo n.º 1
0
        /*--------------------------------------------------------------------------------------------*/
        public void SwitchHands()
        {
            HoverCursorFollower     follow  = GetComponent <HoverCursorFollower>();
            HoverCursorDataProvider curProv = follow.CursorDataProvider;
            ICursorDataForInput     stdFol  = curProv.GetCursorDataForInput(StandardFollowCursor);
            ICursorDataForInput     swiFol  = curProv.GetCursorDataForInput(SwitchedFollowCursor);
            ICursorDataForInput     stdInt  = curProv.GetCursorDataForInput(StandardInteractionCursor);
            ICursorDataForInput     swiInt  = curProv.GetCursorDataForInput(SwitchedInteractionCursor);
            HovercastMirrorSwitcher mirror  = GetComponent <HovercastMirrorSwitcher>();
            bool isMirror = !mirror.UseMirrorLayout;

            if (isMirror)
            {
                mirror.UseMirrorLayout = true;
                follow.CursorType      = SwitchedFollowCursor;

                swiFol.SetCapability(CursorCapabilityType.TransformOnly);
                swiInt.SetCapability(CursorCapabilityType.Full);
                stdFol.SetCapability(CursorCapabilityType.None);
                stdInt.SetCapability(CursorCapabilityType.None);

                swiFol.gameObject.SetActive(true);
                swiInt.gameObject.SetActive(true);
                stdFol.gameObject.SetActive(false);
                stdInt.gameObject.SetActive(false);
            }
            else
            {
                mirror.UseMirrorLayout = false;
                follow.CursorType      = StandardFollowCursor;

                swiFol.SetCapability(CursorCapabilityType.None);
                swiInt.SetCapability(CursorCapabilityType.None);
                stdFol.SetCapability(CursorCapabilityType.TransformOnly);
                stdInt.SetCapability(CursorCapabilityType.Full);

                swiFol.gameObject.SetActive(false);
                swiInt.gameObject.SetActive(false);
                stdFol.gameObject.SetActive(true);
                stdInt.gameObject.SetActive(true);
            }
        }
Ejemplo n.º 2
0
        /*--------------------------------------------------------------------------------------------*/
        protected override void PerformAdjustments()
        {
            HoverCursorDataProvider cursProv   = FindObjectOfType <HoverCursorDataProvider>();
            ICursorDataForInput     palL       = cursProv.GetCursorDataForInput(CursorType.LeftPalm);
            ICursorDataForInput     indR       = cursProv.GetCursorDataForInput(CursorType.RightIndex);
            ICursorDataForInput     look       = cursProv.GetCursorDataForInput(CursorType.Look);
            HovercastInterface      cast       = FindObjectOfType <HovercastInterface>();
            HoverCursorFollower     castFollow = cast.GetComponent <HoverCursorFollower>();

            HoverCursorRendererUpdater[] cursorRendUps =
                Resources.FindObjectsOfTypeAll <HoverCursorRendererUpdater>();

            foreach (HoverCursorRendererUpdater rendUp in cursorRendUps)
            {
                CursorType ct = rendUp.GetComponent <HoverCursorFollower>().CursorType;
                rendUp.gameObject.SetActive(ct != CursorType.LeftPalm && ct != CursorType.RightPalm);
            }

            foreach (ICursorData cursorData in cursProv.Cursors)
            {
                ICursorDataForInput cursorDataInp = cursProv.GetCursorDataForInput(cursorData.Type);
                cursorDataInp.SetCapability(CursorCapabilityType.None);
            }

            palL.SetCapability(CursorCapabilityType.TransformOnly);
            indR.SetCapability(CursorCapabilityType.Full);
            look.SetCapability(CursorCapabilityType.TransformOnly);

            cast.transform.GetChild(0).localPosition =
                new Vector3(0, 0, 0.02f);                 //moves "TransformAdjuster"
            castFollow.CursorType = palL.Type;

            //for non-playing editor...

            palL.SetWorldRotation(Quaternion.Euler(0, 160, 80)); //face the camera (for editor)
            castFollow.Update();                                 //moves interface to the correct cursor transform
            cast.GetComponent <TreeUpdater>().Update();          //forces entire interface to update
        }