Exemplo n.º 1
0
        /// <summary>
        /// 人物移动
        /// </summary>
        protected void ToMove(Vector3 dir)
        {
            Vector3         _dir = transform.TransformDirection(dir.x, 0, dir.z) * speed * Time.deltaTime;
            FirstDataEntity data = (FirstDataEntity)DataEntity;

            data.localPosition = _dir;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 旋转player
        /// </summary>
        /// <param name="value">鼠标变化值</param>
        public virtual void RotPlayer(Vector2 value)
        {
            FirstDataEntity data = (FirstDataEntity)DataEntity;

            m_PlayerRot *= Quaternion.Euler(0f, value.x, 0f);
            m_CamRot    *= Quaternion.Euler(-value.y, 0f, 0f);

            if (clampVerticalRotation)
            {
                m_CamRot = ClampRotationAroundXAxis(m_CamRot);
            }
            if (smooth)
            {
                Quaternion playerTemp, cameraTemp;
                playerTemp = Quaternion.Slerp(transform.localRotation, m_PlayerRot, smoothTime * Time.deltaTime);
                cameraTemp = Quaternion.Slerp(cameraTrans.localRotation, m_CamRot, smoothTime * Time.deltaTime);

                data.playerRotY = playerTemp.eulerAngles.y;
                data.cameraRotX = cameraTemp.eulerAngles.x;
            }
            else
            {
                data.playerRotY = m_PlayerRot.eulerAngles.y;
                data.cameraRotX = m_CamRot.eulerAngles.x;
            }
        }