Пример #1
0
        /// <summary>
        /// Derived classes will call this method at the beginning of a Unity frame so that the Subsystem
        /// can feed the face events up to their subscribers at the right time in the Unity frame.
        /// </summary>
        protected static void OnBeginFrame()
        {
            foreach (var faceAddedEventArgs in s_FacesAddedThisFrame)
            {
                XRFaceSubsystem faceSubsystem = faceAddedEventArgs.xrFaceSubsystem;
                if (faceSubsystem.faceAdded != null)
                {
                    faceSubsystem.faceAdded.Invoke(faceAddedEventArgs);
                }
            }

            foreach (var faceUpdatedEventArgs in s_FacesUpdatedThisFrame)
            {
                XRFaceSubsystem faceSubsystem = faceUpdatedEventArgs.xrFaceSubsystem;
                if (faceSubsystem.faceUpdated != null)
                {
                    faceSubsystem.faceUpdated.Invoke(faceUpdatedEventArgs);
                }
            }

            foreach (var faceRemovedEventArgs in s_FacesRemovedThisFrame)
            {
                XRFaceSubsystem faceSubsystem = faceRemovedEventArgs.xrFaceSubsystem;
                if (faceSubsystem.faceRemoved != null)
                {
                    faceSubsystem.faceRemoved.Invoke(faceRemovedEventArgs);
                }
            }

            s_FacesAddedThisFrame.Clear();
            s_FacesUpdatedThisFrame.Clear();
            s_FacesRemovedThisFrame.Clear();
        }
Пример #2
0
        /// <summary>
        /// Derived classes will call this method to inform the subsystem of each face removed this frame
        /// </summary>
        /// <param name="xrFace"><see cref="XRFace"/> that was removed.</param>
        /// <param name="faceSubsystem"><see cref="XRFaceSubsystem"/> this face belongs to.</param>
        protected static void InvokeFaceRemovedCallback(XRFace xrFace, XRFaceSubsystem faceSubsystem)
        {
            var faceRemovedEventArgs = new FaceRemovedEventArgs
            {
                xrFace          = xrFace,
                xrFaceSubsystem = faceSubsystem
            };

            s_FacesRemovedThisFrame.Add(faceRemovedEventArgs);
        }