Пример #1
0
        void AddTile(int x, int y, TileBase t)
        {
            for (int i = 0; i < t.vertices.Length; i++)
            {
                vv   = t.vertices[i];
                vf.x = (offset.x + x + vv.x) * scale.x;
                vf.y = (offset.y + y + vv.y) * scale.y;
                meshData.vertices.Add(vf);
            }
            for (int j = 0; j < t.triangles.Length; j++)
            {
                meshData.triangles.Add(faceOffset + t.triangles[j]);
            }
            faceOffset += t.vertices.Length;

            for (int w = 0; w < t.uvs.Length; w++)
            {
                t.uvs[w].z = t.GetTextureIndex(x + (position.x * MapManager.instance.chunkWidth),
                                               y + (position.y * MapManager.instance.chunkHeight), layer);
                meshData.uv.Add(t.uvs[w]);
            }
        }