예제 #1
0
            public bool Replace(Camera inCamera, bool inbSync)
            {
                if (!ReferenceEquals(inCamera, Camera))
                {
                    Camera = inCamera;
                    if (inCamera != null)
                    {
                        m_Tracker = TrackedCamera.Get(Camera);
                        if (inbSync)
                        {
                            UpdateVersion.Sync(m_Tracker, ref m_Version);
                        }
                        else
                        {
                            UpdateVersion.Reset(ref m_Version);
                        }
                    }
                    else
                    {
                        m_Tracker = null;
                        m_Version = -2;
                    }
                }

                return(false);
            }
예제 #2
0
        /// <summary>
        /// Locates the TrackedCamera for the given camera.
        /// </summary>
        static public TrackedCamera Get(Camera inCamera)
        {
            TrackedCamera tracker = inCamera.GetComponent <TrackedCamera>();

            if (!tracker)
            {
                tracker           = inCamera.gameObject.AddComponent <TrackedCamera>();
                tracker.hideFlags = HideFlags.HideAndDontSave | HideFlags.HideInInspector;
            }
            return(tracker);
        }
예제 #3
0
            public bool HasChanged()
            {
                if (Camera.IsReferenceDestroyed() || m_Tracker.IsReferenceDestroyed())
                {
                    Camera    = null;
                    m_Tracker = null;
                    m_Version = -1;
                    return(true);
                }

                if (!m_Tracker.IsReferenceNull())
                {
                    return(m_Tracker.HasChanged(ref m_Version));
                }

                if (m_Version == -2)
                {
                    m_Version = -1;
                    return(true);
                }

                return(false);
            }
예제 #4
0
 public void Clear()
 {
     Camera    = null;
     m_Tracker = null;
     m_Version = -1;
 }