• <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
            三國志14在尋路時可以顯示出所行走路徑,思考了下,可以用以下方式做到:

            實現(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 閱讀(305) 評論(0)  編輯 收藏 引用

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


            97久久久精品综合88久久| 国产亚洲精品久久久久秋霞 | 精品熟女少妇a∨免费久久| 欧美黑人又粗又大久久久 | 丰满少妇人妻久久久久久4| 欧美激情精品久久久久久久| 久久香蕉国产线看观看精品yw| 亚洲国产精品久久久久| 亚洲欧美国产精品专区久久| 久久发布国产伦子伦精品| 久久亚洲国产成人精品无码区| 国产精品禁18久久久夂久| 久久亚洲国产成人影院网站| 国内精品久久久久| 亚洲AV日韩精品久久久久久久| 品成人欧美大片久久国产欧美...| 久久人与动人物a级毛片| 亚洲国产精品久久久久婷婷老年 | 色偷偷88888欧美精品久久久| 久久婷婷国产麻豆91天堂| 99久久精品国产一区二区| 精品久久久久中文字| 99国内精品久久久久久久| 亚洲国产欧洲综合997久久| 亚洲日本久久久午夜精品| 久久久久一本毛久久久| 色综合久久最新中文字幕| 久久精品国产亚洲AV嫖农村妇女| 久久久这里只有精品加勒比| 久久精品国产国产精品四凭| 国产午夜精品久久久久九九| 2020最新久久久视精品爱| 久久se精品一区二区| 99久久中文字幕| yellow中文字幕久久网| 国产综合免费精品久久久| 久久久久女教师免费一区| 色婷婷久久久SWAG精品| 一本一道久久a久久精品综合| 久久亚洲精品国产精品婷婷| 久久久午夜精品|