コード例 #1
0
        /// <summary>
        /// Sets the transform's rotation on the given axis.
        /// </summary>
        static public void SetRotation(this Transform inTransform, Vector3 inRotation, Axis inAxis = Axis.XYZ, Space inSpace = Space.World)
        {
            if (inAxis != 0)
            {
                Vector3 rotation;
                if (inAxis == Axis.XYZ)
                {
                    rotation = inRotation;
                }
                else
                {
                    EulerStorage record = EulerStorage.GetRecord(inTransform);
                    if (record != null)
                    {
                        rotation = record.Get(inSpace);
                        VectorUtil.CopyFrom(ref rotation, inRotation, inAxis);
                        record.Set(inSpace, rotation);
                    }
                    else
                    {
                        rotation = (inSpace == Space.Self ? inTransform.localEulerAngles : inTransform.eulerAngles);
                        VectorUtil.CopyFrom(ref rotation, inRotation, inAxis);
                    }
                }

                if (inSpace == Space.Self)
                {
                    inTransform.localEulerAngles = rotation;
                }
                else
                {
                    inTransform.localEulerAngles = rotation;
                }
            }
        }
コード例 #2
0
 public void OnTweenEnd()
 {
     if ((m_Properties & TransformProperties.Rotation) != 0)
     {
         EulerStorage.RemoveTransform(m_RecordID);
     }
 }
コード例 #3
0
 public void OnTweenStart()
 {
     m_Start = new TransformState(m_Transform, m_End.Space);
     if ((m_Properties & TransformProperties.Rotation) != 0)
     {
         EulerStorage.AddTransform(m_Transform);
         m_RecordID = m_Transform.GetInstanceID();
     }
 }
コード例 #4
0
        private Vector3 GetRotation(Transform inTransform)
        {
            EulerStorage record = EulerStorage.GetRecord(inTransform);

            if (record != null)
            {
                return(record.Get(m_Space));
            }
            return(m_Space == UnityEngine.Space.Self ? inTransform.localEulerAngles : inTransform.eulerAngles);
        }
コード例 #5
0
        private Vector3 GetRotation(RectTransform inTransform)
        {
            EulerStorage record = EulerStorage.GetRecord(inTransform);

            if (record != null)
            {
                return(record.Get(Space.Self));
            }
            return(inTransform.localEulerAngles);
        }
コード例 #6
0
            public void OnTweenStart()
            {
                m_Record   = EulerStorage.AddTransform(m_Transform);
                m_RecordID = m_Transform.GetInstanceID();

                m_Start = m_Record.Get(m_Space);
                m_Delta = m_Target - m_Start;

                if (m_Mode != AngleMode.Absolute)
                {
                    WrapEuler(ref m_Delta);
                }
            }
コード例 #7
0
 public void OnTweenEnd()
 {
     EulerStorage.RemoveTransform(m_RecordID);
 }