Exemplo n.º 1
0
        //将物体运动方向转化为地图上的箭头指示
        public virtual void ImageEuler(Vector3 moveDirection)
        {
            Vector2 xzDir       = new Vector2(moveDirection.x, moveDirection.z);
            Vector3 eulerAngles = Quaternion.FromToRotation(Vector3.forward, moveDirection).eulerAngles;

            playerImage.localEulerAngles = new Vector3(0, 0, 90 + U_Math.Vector2ToEulerY(xzDir));
        }
Exemplo n.º 2
0
        public virtual Vector2 GetTrueRatio(Transform tran)
        {
            Vector4 camCorner = U_Camera.GetCorners_Vector4(cam, camSectionHeight);
            float   xRatio    = U_Math.GetRatio(tran.position.x, camCorner.z, camCorner.w);
            float   zRatio    = U_Math.GetRatio(tran.position.z, camCorner.y, camCorner.x);

            return(new Vector2(xRatio, zRatio));
        }
Exemplo n.º 3
0
        public virtual void PostionToMapPosition(Transform tran, RectTransform rectTran)
        {
            Vector4 camCorner = U_Camera.GetCorners_Vector4(cam, camSectionHeight);
            float   xRatio    = U_Math.GetRatio(tran.position.x, camCorner.z, camCorner.w);
            float   zRatio    = U_Math.GetRatio(tran.position.z, camCorner.y, camCorner.x);
            float   x         = xRatio * bg_width + bg_left;
            float   y         = zRatio * bg_height + bg_bottom;

            rectTran.anchoredPosition = new Vector2(x, y);
        }