예제 #1
0
        /// VRBasePointer calls this when it is created.
        /// If a pointer hasn't already been assigned, it
        /// will assign the newly created one by default.
        ///
        /// This simplifies the common case of having only one
        /// IVRPointer so is can be automatically hooked up
        /// to the manager.  If multiple VRBasePointer are in
        /// the scene, the app has to take responsibility for
        /// setting which one is active.
        public void RegisterPointer(VRBasePointer pointer)
        {
            if (Instance == null)
            {
                return;
            }

            if (!pointers.Contains(pointer))
            {
                pointers.Add(pointer);
            }
        }
예제 #2
0
        public void RemovePointer(VRBasePointer pointer)
        {
            if (pointer == null)
            {
                return;
            }

            pointers.Remove(pointer);

            if (VRPointerManager.Pointer == pointer)
            {
                VRPointerManager.Pointer = pointers.Count == 0 ? null : pointers[pointers.Count - 1];
            }

            if (VRPointerManager.Pointer != null && VRPointerManager.Pointer.gameObject.activeSelf)
            {
                VRPointerManager.Pointer.gameObject.SetActive(true);
            }
        }