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

            實現方式:
            // 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 閱讀(287) 評論(0)  編輯 收藏 引用
            久久久久人妻一区精品性色av| 久久久噜噜噜久久中文字幕色伊伊| 久久久久国产精品| 秋霞久久国产精品电影院| 久久国产精品99精品国产| 青青草原综合久久| 精品久久久一二三区| 亚洲国产另类久久久精品黑人| 91精品国产综合久久精品| 久久国产精品一区| 国产精品视频久久久| 久久无码人妻精品一区二区三区 | 国内精品久久久久久久coent| 久久久国产精品| 婷婷久久久亚洲欧洲日产国码AV| 999久久久国产精品| 99国产欧美精品久久久蜜芽| 91久久福利国产成人精品| 伊人久久无码中文字幕| 久久人人爽人人爽人人片AV东京热| 久久成人精品视频| 九九99精品久久久久久| 国产精品99久久久久久宅男小说| 免费观看成人久久网免费观看| 人妻无码精品久久亚瑟影视| 国产亚洲精午夜久久久久久 | 久久人人爽人人爽人人AV东京热 | 亚洲国产天堂久久久久久| 久久亚洲高清综合| 91亚洲国产成人久久精品| 久久久久亚洲AV片无码下载蜜桃| 亚洲午夜无码AV毛片久久| 久久精品国产亚洲一区二区三区| 97热久久免费频精品99| 久久中文骚妇内射| 精品免费久久久久久久| 蜜桃麻豆www久久| 日本道色综合久久影院| 18岁日韩内射颜射午夜久久成人| 狠狠干狠狠久久| 国产精品gz久久久|