示例#1
0
    public void FillWithData(byte[,] neighborTiles, RoomGenerator.TileType[,] tiles)
    {
        int height, width;
        width = tiles.GetLength (0);
        height = tiles.GetLength (1);

        for(int y = 0; y < height; y ++) {
            for (int x = 0; x < width; x ++) {
                if (tiles[x, y] != RoomGenerator.TileType.Empty){
                    Trunk t = GetTrunk(x, y);
                    Vector2[] uvlis;

                    byte neighbotValue = neighborTiles[x, y];

        //					Debug.Log(neighbotValue);
                    if (Config.NEIGHBOR_TO_WALLTYPE_2(neighbotValue) != Config.WallType.NOT_A_WALL){
                        uvlis = TextureConfig.WallUvMap[ Config.NEIGHBOR_TO_WALLTYPE_2(neighbotValue) ];
                    }else{
                        uvlis = new Vector2[]{ new Vector2(), new Vector2(), new Vector2(), new Vector2() };
                    }

                    t.FillTile(x, y, uvlis);
                }
            }
        }

        for (int i = 0; i < MaxTrunks; i ++)
            if (trunks [i] != null)
                trunks [i].GenerateMesh ();
    }