Пример #1
0
            public bool Replace(Transform inTransform, bool inbSync)
            {
                if (!ReferenceEquals(inTransform, Transform))
                {
                    Transform = inTransform;
                    if (inTransform != null)
                    {
                        m_Tracker = TrackedTransform.Get(Transform);
                        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 TrackedTransform for the given transform.
        /// </summary>
        static public TrackedTransform Get(Transform inTransform)
        {
            TrackedTransform tracker = inTransform.GetComponent <TrackedTransform>();

            if (!tracker)
            {
                tracker = inTransform.gameObject.AddComponent <TrackedTransform>();
            }
            return(tracker);
        }
Пример #3
0
        /// <summary>
        /// Locates the TrackedTransform for the given transform.
        /// </summary>
        static public TrackedTransform Get(Transform inTransform)
        {
            TrackedTransform tracker = inTransform.GetComponent <TrackedTransform>();

            if (!tracker)
            {
                tracker           = inTransform.gameObject.AddComponent <TrackedTransform>();
                tracker.hideFlags = HideFlags.HideAndDontSave | HideFlags.HideInInspector;
            }
            return(tracker);
        }
Пример #4
0
            public bool HasChanged()
            {
                if (Transform.IsReferenceDestroyed() || m_Tracker.IsReferenceDestroyed())
                {
                    Transform = 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);
            }
Пример #5
0
 public void Clear()
 {
     Transform = null;
     m_Tracker = null;
     m_Version = -1;
 }