void OnEnable()
        {
            ivrTraditional = (IVR_Traditional)target;
            ivr            = ivrTraditional.GetComponent <InstantVR>();

            if (ivr != null)
            {
                traditionalHead = ivr.headTarget.GetComponent <IVR_TraditionalHead>();
                if (traditionalHead == null)
                {
                    traditionalHead           = ivr.headTarget.gameObject.AddComponent <IVR_TraditionalHead>();
                    traditionalHead.extension = ivrTraditional;
                }

                traditionalLeftHand = ivr.leftHandTarget.GetComponent <IVR_TraditionalHand>();
                if (traditionalLeftHand == null)
                {
                    traditionalLeftHand           = ivr.leftHandTarget.gameObject.AddComponent <IVR_TraditionalHand>();
                    traditionalLeftHand.extension = ivrTraditional;
                }

                traditionalRightHand = ivr.rightHandTarget.GetComponent <IVR_TraditionalHand>();
                if (traditionalRightHand == null)
                {
                    traditionalRightHand           = ivr.rightHandTarget.gameObject.AddComponent <IVR_TraditionalHand>();
                    traditionalRightHand.extension = ivrTraditional;
                }

                IVR_Extension[] extensions = ivr.GetComponents <IVR_Extension>();
                if (ivrTraditional.priority == -1)
                {
                    ivrTraditional.priority = extensions.Length - 1;
                }
                for (int i = 0; i < extensions.Length; i++)
                {
                    if (ivrTraditional == extensions[i])
                    {
                        while (i < ivrTraditional.priority)
                        {
                            MoveUp(traditionalHead);
                            MoveUp(traditionalLeftHand);
                            MoveUp(traditionalRightHand);
                            ivrTraditional.priority--;
                            //Debug.Log ("Traditional Move up to : " + i + " now: " + ivrTraditional.priority);
                        }
                        while (i > ivrTraditional.priority)
                        {
                            MoveDown(traditionalHead);
                            MoveDown(traditionalLeftHand);
                            MoveDown(traditionalRightHand);
                            ivrTraditional.priority++;
                            //Debug.Log ("Traditional Move down to : " + i + " now: " + ivrTraditional.priority);
                        }
                    }
                }
            }
        }
        void OnEnable()
        {
            ivrUnity = (IVR_UnityVR)target;
            if (!ivrUnity)
            {
                return;
            }

            ivr = ivrUnity.GetComponent <InstantVR>();

            if (ivr != null)
            {
                unityHead = ivr.headTarget.GetComponent <IVR_UnityVRHead>();
                if (unityHead == null)
                {
                    unityHead           = ivr.headTarget.gameObject.AddComponent <IVR_UnityVRHead>();
                    unityHead.extension = ivrUnity;
                }

                IVR_Extension[] extensions = ivr.GetComponents <IVR_Extension>();
                if (ivrUnity.priority == -1)
                {
                    ivrUnity.priority = extensions.Length - 1;
                }
                for (int i = 0; i < extensions.Length; i++)
                {
                    if (ivrUnity == extensions[i])
                    {
                        while (i < ivrUnity.priority)
                        {
                            MoveUp(unityHead);
                            ivrUnity.priority--;
                            //Debug.Log ("Rift Move up to : " + i + " now: " + ivrRift.priority);
                        }
                        while (i > ivrUnity.priority)
                        {
                            MoveDown(unityHead);
                            ivrUnity.priority++;
                            //Debug.Log ("Rift Move down to : " + i + " now: " + ivrRift.priority);
                        }
                    }
                }
            }
        }
Пример #3
0
        void OnEnable()
        {
            ivrCardboard = (IVR_Cardboard)target;
            ivr          = ivrCardboard.GetComponent <InstantVR>();

            if (ivr != null)
            {
                cardboardHead = ivr.headTarget.GetComponent <IVR_CardboardHead>();
                if (cardboardHead == null)
                {
                    cardboardHead           = ivr.headTarget.gameObject.AddComponent <IVR_CardboardHead>();
                    cardboardHead.extension = ivrCardboard;
                }

                IVR_Extension[] extensions = ivr.GetComponents <IVR_Extension>();
                if (ivrCardboard.priority == -1)
                {
                    ivrCardboard.priority = extensions.Length - 1;
                }
                for (int i = 0; i < extensions.Length; i++)
                {
                    if (ivrCardboard == extensions[i])
                    {
                        while (i < ivrCardboard.priority)
                        {
                            MoveUp(cardboardHead);
                            ivrCardboard.priority--;
                            //Debug.Log ("Cardboard Move up to : " + i + " now: " + ivrRift.priority);
                        }
                        while (i > ivrCardboard.priority)
                        {
                            MoveDown(cardboardHead);
                            ivrCardboard.priority++;
                            //Debug.Log ("Cardboard Move down to : " + i + " now: " + ivrRift.priority);
                        }
                    }
                }
            }
        }
Пример #4
0
        void OnEnable()
        {
            ivranimator = (IVR_Animator)target;
            if (!ivranimator)
            {
                return;
            }

            ivr = ivranimator.GetComponent <InstantVR>();

            if (ivr != null)
            {
                animatorHead = ivr.headTarget.GetComponent <IVR_AnimatorHead>();
                if (animatorHead == null)
                {
                    animatorHead           = ivr.headTarget.gameObject.AddComponent <IVR_AnimatorHead>();
                    animatorHead.extension = ivranimator;
                }

                animatorLeftHand = ivr.leftHandTarget.GetComponent <IVR_AnimatorHand>();
                if (animatorLeftHand == null)
                {
                    animatorLeftHand           = ivr.leftHandTarget.gameObject.AddComponent <IVR_AnimatorHand>();
                    animatorLeftHand.extension = ivranimator;
                }

                animatorRightHand = ivr.rightHandTarget.GetComponent <IVR_AnimatorHand>();
                if (animatorRightHand == null)
                {
                    animatorRightHand           = ivr.rightHandTarget.gameObject.AddComponent <IVR_AnimatorHand>();
                    animatorRightHand.extension = ivranimator;
                }

                animatorHip = ivr.hipTarget.GetComponent <IVR_AnimatorHip>();
                if (animatorHip == null)
                {
                    animatorHip           = ivr.hipTarget.gameObject.AddComponent <IVR_AnimatorHip>();
                    animatorHip.extension = ivranimator;
                }

                animatorLeftFoot = ivr.leftFootTarget.GetComponent <IVR_AnimatorFoot>();
                if (animatorLeftFoot == null)
                {
                    animatorLeftFoot           = ivr.leftFootTarget.gameObject.AddComponent <IVR_AnimatorFoot>();
                    animatorLeftFoot.extension = ivranimator;
                }

                animatorRightFoot = ivr.rightFootTarget.GetComponent <IVR_AnimatorFoot>();
                if (animatorRightFoot == null)
                {
                    animatorRightFoot           = ivr.rightFootTarget.gameObject.AddComponent <IVR_AnimatorFoot>();
                    animatorRightFoot.extension = ivranimator;
                }

                IVR_Extension[] extensions = ivr.GetComponents <IVR_Extension>();
                if (ivranimator.priority == -1)
                {
                    ivranimator.priority = extensions.Length - 1;
                }
                for (int i = 0; i < extensions.Length; i++)
                {
                    if (ivranimator == extensions[i])
                    {
                        while (i < ivranimator.priority)
                        {
                            MoveUp(animatorHead);
                            MoveUp(animatorLeftHand);
                            MoveUp(animatorRightHand);
                            MoveUp(animatorHip);
                            MoveUp(animatorLeftFoot);
                            MoveUp(animatorRightFoot);
                            ivranimator.priority--;
                            //Debug.Log ("Animator Move up to : " + i + " now: " + ivranimator.priority);
                        }
                        while (i > ivranimator.priority)
                        {
                            MoveDown(animatorHead);
                            MoveDown(animatorLeftHand);
                            MoveDown(animatorRightHand);
                            MoveDown(animatorHip);
                            MoveDown(animatorLeftFoot);
                            MoveDown(animatorRightFoot);
                            ivranimator.priority++;
                            //Debug.Log ("Animator Move down to : " + i + " now: " + ivranimator.priority);
                        }
                    }
                }
            }
        }