示例#1
0
        /// <summary>
        /// Set the rotation from the Vector3 Euler angles
        /// </summary>
        /// <param name="index"></param>
        public override void SetIndex(int index)
        {
            base.SetIndex(index);

            // get the rotation and convert it to a Quaternion
            Vector3 item = Array[Index];

            Quaternion rotation = Quaternion.identity;

            rotation.eulerAngles = item;

            // set the rotation
            if (mRotation != null)
            {
                mRotation.ToLocalTransform = UseLocalRotation;
                mRotation.TargetValue      = rotation;
                mRotation.StartRunning();
            }
            else
            {
                if (UseLocalRotation)
                {
                    TargetObject.transform.localRotation = rotation;
                }
                else
                {
                    TargetObject.transform.rotation = rotation;
                }
            }
        }
示例#2
0
        public override void SetIndex(int index)
        {
            base.SetIndex(index);
            Transform item = Array[Index];

            Quaternion rotation = Quaternion.identity; rotation.eulerAngles = item.eulerAngles;
            Vector3    position = item.position;
            Vector3    scale    = item.localScale;

            //Use Move To Position
            if (mMoveTranslator != null)
            {
                mMoveTranslator.ToLocalTransform = UseLocalPosition;
                mMoveTranslator.TargetValue      = position;
                mMoveTranslator.StartRunning();
            }
            else
            {
                if (UseLocalPosition)
                {
                    TargetObject.transform.localPosition = position;
                }
                else
                {
                    TargetObject.transform.position = position;
                }
            }

            //Set The Rotation
            if (mRotation != null)
            {
                mRotation.ToLocalTransform = UseLocalRotation;
                mRotation.TargetValue      = rotation;
                mRotation.StartRunning();
            }
            else
            {
                if (UseLocalRotation)
                {
                    TargetObject.transform.localRotation = rotation;
                }
                else
                {
                    TargetObject.transform.rotation = rotation;
                }
            }

            //Set Scale
            if (isFirstCall)
            {
                StartScale  = TargetObject.transform.localScale;
                isFirstCall = false;
            }

            //item = Current;

            if (mScaler != null)
            {
                mScaler.TargetValue = scale;
                mScaler.StartRunning();
            }
            else
            {
                TargetObject.transform.localScale = scale;
            }
        }