Example #1
0
    void genFrontSide(int x, int y, int z)
    {
        vertecis.Add(new Vector3(x + 0.5f, y + 0.5f, z + 0.5f));
        vertecis.Add(new Vector3(x - 0.5f, y + 0.5f, z + 0.5f));
        vertecis.Add(new Vector3(x - 0.5f, y - 0.5f, z + 0.5f));
        vertecis.Add(new Vector3(x + 0.5f, y - 0.5f, z + 0.5f));


        tris.Add(sqaure * 4);
        tris.Add((sqaure * 4) + 1);
        tris.Add((sqaure * 4) + 3);
        tris.Add((sqaure * 4) + 1);
        tris.Add((sqaure * 4) + 2);
        tris.Add((sqaure * 4) + 3);

        Vector2 texture = Vector2.zero;

        if (id == 0)
        {
            texture = BlockDictionairy.getUv((up == null) ? 1 : 0);
        }
        else
        {
            texture = BlockDictionairy.getUv(id);
        }

        uv.Add(new Vector2(uvSize * texture.x + uvSize, uvSize * texture.y + uvSize));
        uv.Add(new Vector2(uvSize * texture.x, uvSize * texture.y + uvSize));
        uv.Add(new Vector2(uvSize * texture.x, uvSize * texture.y));
        uv.Add(new Vector2(uvSize * texture.x + uvSize, uvSize * texture.y));


        sqaure++;
    }
Example #2
0
 public static BlockDictionairy getInstance()
 {
     if (instance == null)
     {
         instance = new BlockDictionairy();
     }
     return(instance);
 }