• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 72,  comments - 4,  trackbacks - 0
            三國(guó)志14在尋路時(shí)可以顯示出所行走路徑,思考了下,可以用以下方式做到:

            實(shí)現(xiàn)方式:
            // uv=x,y, rotation = z
                    public static readonly kPathArrow[,] combineType =
                    {
                        // 右上,右上               右,                           右下,               左下,                 左,                    左上
                        {new kPathArrow(0, 60), new kPathArrow(5, 180),    new kPathArrow(2, 180), new kPathArrow(6, 120), new kPathArrow(7, 0), new kPathArrow(3, 0)},
                        // 右
                        {new kPathArrow(5, 180), new kPathArrow(1, 180),    new kPathArrow(4, 180), new kPathArrow(7, 180), new kPathArrow(6, 0), new kPathArrow(8, 180)},
                        // 右下
                        {new kPathArrow(2, 180), new kPathArrow(4, 180),    new kPathArrow(0, 180), new kPathArrow(3, 180), new kPathArrow(8, 0), new kPathArrow(6, 60)},
                        // 左下
                        {new kPathArrow(6, 120), new kPathArrow(7, 180),    new kPathArrow(3, 180), new kPathArrow(0, -120), new kPathArrow(5, 0), new kPathArrow(2, 0)},
                        // 左
                        {new kPathArrow(7, 0), new kPathArrow(6, 0),    new kPathArrow(8, 0),    new kPathArrow(5, 0), new kPathArrow(1, 0), new kPathArrow(4, 0)},
                        // 左上
                        {new kPathArrow(3, 0), new kPathArrow(8, 180),   new kPathArrow(6, 60), new kPathArrow(2, 0), new kPathArrow(4, 0), new kPathArrow(0, 0)},
                    };
                    private Vector3 RotVertex(Vector3 point, float rot)
                    {
                        Vector3 pos = point;
                        float cs = Mathf.Cos(rot);
                        float sn = Mathf.Sin(rot);
                        pos.x = point.x * cs + point.z * sn;
                        pos.z = -point.x * sn + point.z * cs;
                        return pos;
                    }
                    //----------------------------------------------------------------------------------------------
                    public void AddPathTile(int x, int z, int idx)
                    {
                        int enterDir = idx / (int)kHexGrid.HexDirection.MAX;
                        int outDir = idx % (int)kHexGrid.HexDirection.MAX;
                        kPathArrow pathArrow = combineType[enterDir, outDir];
                        int rowUV = pathArrow.idx / 3;
                        int colUV = pathArrow.idx % 3;
                        float rot = pathArrow.angle * Mathf.PI/180.0f;
                        Vector3 center = kHexGrid.ToWorldPos(x, z);
                        Vector2 centerUV = new Vector2(0.5f, 0.5f);
                        Vector2 uvStart = new Vector2(colUV * 1 / 3.0f, rowUV * 1 / 3.0f);
                        for (kHexGrid.HexDirection dir = kHexGrid.HexDirection.NE; dir <= kHexGrid.HexDirection.NW; dir++)
                        {
                            Vector3 v1 = center + new Vector3(0,0.01f,0);
                            Vector3 v2 = kHexGrid.cornerPos[(int)dir] + new Vector3(0, 0.01f, 0);
                            Vector3 v3 = kHexGrid.cornerPos[(int)dir + 1] + new Vector3(0, 0.01f, 0);
                            if (rot > 0.0001f || rot < -0.0001f)
                            {
                                v2 = RotVertex(v2, rot);
                                v3 = RotVertex(v3, rot);
                            }
                            AddTriangle(v1, center + v2, center + v3,
                                uvStart + centerUV * 1/3.0f, uvStart + kHexGrid.cornerUV[(int)dir] * 1 / 3.0f, uvStart + kHexGrid.cornerUV[(int)dir + 1] * 1 / 3.0f,
                                Color.white);
                        }
                    }
            丑圖效果:

            所用貼圖
            posted on 2020-03-26 20:33 flipcode 閱讀(291) 評(píng)論(0)  編輯 收藏 引用

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


            国产伊人久久| 久久国产精品成人影院| 国产成人久久精品区一区二区| 久久精品毛片免费观看| 久久久久一区二区三区| 久久久久亚洲精品中文字幕| 久久这里只有精品首页| 久久99精品久久久久婷婷| 久久99久久无码毛片一区二区| 少妇熟女久久综合网色欲| 韩国免费A级毛片久久| 久久久久久极精品久久久| 色综合久久综合中文综合网| 久久国产精品一区| 久久久久久亚洲AV无码专区| 国产高潮国产高潮久久久91 | 精品久久久久久久久午夜福利| 久久综合中文字幕| 午夜精品久久久久久中宇| 国产精品亚洲美女久久久| 日产精品久久久一区二区| 久久久久亚洲爆乳少妇无| 色噜噜狠狠先锋影音久久| 亚洲精品乱码久久久久久蜜桃不卡| 久久精品国产亚洲7777| 97精品伊人久久大香线蕉app | 久久无码人妻一区二区三区午夜| 久久久噜噜噜久久中文字幕色伊伊| 久久精品国产网红主播| 久久香综合精品久久伊人| 日韩中文久久| 久久综合视频网站| 久久久这里有精品中文字幕| 99久久综合国产精品二区| 精品国产福利久久久| 久久香蕉超碰97国产精品 | 久久久久黑人强伦姧人妻| 久久99热精品| 99热热久久这里只有精品68| 91精品国产91热久久久久福利 | 国产免费久久精品99re丫y|