예제 #1
0
        protected override void ApplyConstraints()
        {
            base.ApplyConstraints();

            if (m_AppliedPinTarget.IsReferenceDestroyed())
            {
                TryUnpin(true);
            }
            else if (!m_AppliedPinTarget.IsReferenceNull())
            {
                bool bNowOnScreen = RecalculatePosition();
                if (bNowOnScreen != m_PinOnScreen)
                {
                    m_PinOnScreen = bNowOnScreen;
                    if (ShouldProcess)
                    {
                        if (m_PinOnScreen)
                        {
                            m_OnPinAppear.Invoke(m_AppliedPinTarget);
                        }
                        else
                        {
                            m_OnPinDisappear.Invoke(m_AppliedPinTarget);
                        }
                    }
                }

                ApplyPosition();

                if (m_PinOnScreen && ShouldProcess)
                {
                    m_OnPinUpdate.Invoke(m_AppliedPinTarget, m_CurrentPinPosition);
                }
            }
        }
예제 #2
0
        private bool TryUnpin(bool inbForce)
        {
            if (inbForce || !m_AppliedPinTarget.IsReferenceNull())
            {
                Transform oldTarget = m_CurrentTarget;
                m_AppliedPinTarget = null;
                m_CurrentTarget    = null;

                m_WorldCameraGroup.Clear();
                m_CanvasCameraGroup.Clear();
                m_TargetTransformGroup.Clear();

                if (ShouldProcess)
                {
                    m_OnPinEnd.Invoke(oldTarget);
                }

                return(true);
            }

            return(false);
        }