显示时,地图在水平轴上翻转

时间:2015-05-28 11:35:00

标签: c# unity3d

我在屏幕上显示地图时遇到问题。我给开发人员在方形瓷砖和六边形瓷砖之间做出选择。地图保存为.txt

正方形平铺地图如图所示正确显示 enter image description here

六角形地图倒置的地方 enter image description here

我完全不知道如何解决我提供的整个功能问题

void displayMap(){

    //Draw Tiles on the Screen

    if (useSquareTiles == true && useHexagonTiles == false) {
        for (int y = 0; y < mapHeight; y++) {
            for (int x = 0; x < mapWidth; x++) {
                GameObject.Instantiate (mapArray [y] [x], new Vector3 (x, mapHeight - y, 0),
                                        Quaternion.Euler (-90, 0, 0));
            }
        }
    }

    float hexWidth = 0.85f; //The width of the HexTiles
    if (useHexagonTiles == true && useSquareTiles == false) {
        for (int y = 0; y < mapHeight; y++) {
            for (int x = 0; x < mapWidth; x++) {
                GameObject.Instantiate (mapArray[y][x], new Vector3 (x * hexWidth, y + (0.5f * Mathf.Abs (x) % 1), 0),
                                        Quaternion.Euler (-90, 0, 0));
            }
        }
    }


}

0 个答案:

没有答案