Пример #1
0
 public override WorldTypes.Tile TexturePosition(WorldTypes.Direction direction)
 {
     WorldTypes.Tile tile = new WorldTypes.Tile();
     tile.x = GetRandom(0, 4.9f);
     tile.y = 1;
     return(tile);
 }
Пример #2
0
 public override WorldTypes.Tile TexturePosition(WorldTypes.Direction direction)
 {
     WorldTypes.Tile tile = new WorldTypes.Tile();
     tile.x = 0;
     tile.y = 2;
     return(tile);
 }
Пример #3
0
    public override Vector2[] FaceUVs(WorldTypes.Direction direction)
    {
        Vector2[]       UVs       = new Vector2[4];
        WorldTypes.Tile tilePos   = TexturePosition(direction);
        float           tileSizeX = 1.0f;
        float           tileSizeY = 0.25f;

        UVs[0] = new Vector2(tileSizeX * tilePos.x,
                             (tileSize * tilePos.y) + 0.01f);
        UVs[1] = new Vector2(tileSizeX * tilePos.x,
                             (tileSizeY * tilePos.y + tileSizeY) - 0.05f);
        UVs[2] = new Vector2(tileSizeX * tilePos.x + tileSizeX,
                             (tileSizeY * tilePos.y + tileSizeY) - 0.05f);
        UVs[3] = new Vector2(tileSizeX * tilePos.x + tileSizeX,
                             (tileSize * tilePos.y) + 0.01f);

        /*	UVs[7] = new Vector2(tileSizeX * tilePos.x,
         *                           tileSizeY * tilePos.y);
         *      UVs[6] = new Vector2(tileSizeX * tilePos.x,
         *                           tileSizeY * tilePos.y + tileSizeY);
         *      UVs[5] = new Vector2(tileSizeX * tilePos.x + tileSizeX,
         *                           tileSizeY * tilePos.y + tileSizeY);
         *      UVs[4] = new Vector2(tileSizeX * tilePos.x + tileSizeX,
         *                           tileSizeY * tilePos.y);
         */
        return(UVs);
    }
Пример #4
0
    public virtual WorldTypes.Tile TexturePosition(WorldTypes.Direction direction)
    {
        WorldTypes.Tile tile = new WorldTypes.Tile();
        tile.x = 0;
        tile.y = 0;

        return(tile);
    }
Пример #5
0
    public Vector3[] CreateTri(float x, float y, float z, WorldTypes.Direction direction)
    {
        Vector3 [] verts;
        if (direction == WorldTypes.Direction.west || direction == WorldTypes.Direction.east)
        {
            verts = new Vector3[3];
        }
        else
        {
            verts = new Vector3[4];
        }

        switch (direction)
        {
        case WorldTypes.Direction.up:
            verts [0] = addtoCube(x, y, z, Shape.getVert(0, 0.5f));
            verts [1] = addtoCube(x, y, z, Shape.getVert(4, 0.5f));
            verts [2] = addtoCube(x, y, z, Shape.getVert(24, -0.5f));
            verts [3] = addtoCube(x, y, z, Shape.getVert(20, -0.5f));
            break;

        case WorldTypes.Direction.down:
            verts [0] = addtoCube(x, y, z, Shape.getVert(20, -0.5f));
            verts [1] = addtoCube(x, y, z, Shape.getVert(24, -0.5f));
            verts [2] = addtoCube(x, y, z, Shape.getVert(4, -0.5f));
            verts [3] = addtoCube(x, y, z, Shape.getVert(0, -0.5f));
            break;

        case WorldTypes.Direction.north:
            verts [0] = addtoCube(x, y, z, Shape.getVert(4, -0.5f));
            verts [1] = addtoCube(x, y, z, Shape.getVert(4, 0.5f));
            verts [2] = addtoCube(x, y, z, Shape.getVert(0, 0.5f));
            verts [3] = addtoCube(x, y, z, Shape.getVert(0, -0.5f));
            break;

        case WorldTypes.Direction.south:
            verts [0] = addtoCube(x, y, z, Shape.getVert(20, -0.5f));
            verts [1] = addtoCube(x, y, z, Shape.getVert(20, 0.5f));
            verts [2] = addtoCube(x, y, z, Shape.getVert(24, 0.5f));
            verts [3] = addtoCube(x, y, z, Shape.getVert(24, -0.5f));
            break;

        case WorldTypes.Direction.west:
            verts [0] = addtoCube(x, y, z, Shape.getVert(0, -0.5f));
            verts [1] = addtoCube(x, y, z, Shape.getVert(0, 0.5f));
            verts [2] = addtoCube(x, y, z, Shape.getVert(20, -0.5f));
            break;

        case WorldTypes.Direction.east:
            verts [0] = addtoCube(x, y, z, Shape.getVert(24, -0.5f));
            verts [1] = addtoCube(x, y, z, Shape.getVert(4, 0.5f));
            verts [2] = addtoCube(x, y, z, Shape.getVert(4, -0.5f));
            break;
        }
        return(verts);
    }
Пример #6
0
    public Vector3[] CreateBillboard(float x, float y, float z, WorldTypes.Direction direction)
    {
        Vector3 [] verts = new Vector3[4];
        if (which)
        {
            switch (direction)
            {
            case WorldTypes.Direction.north:
                /*verts [0] = addtoCube(x,y,z,Shape.getVert(listTwo[2],-0.5f),offsetX,offsetZ);
                 * verts [1] = addtoCube(x,y,z,Shape.getVert(listTwo[2],0.5f),offsetX,offsetZ);
                 * verts [2] = addtoCube(x,y,z,Shape.getVert(listTwo[1],0.5f),offsetX,offsetZ);
                 * verts [3] = addtoCube(x,y,z,Shape.getVert(listTwo[1],-0.5f),offsetX,offsetZ); */
                verts [0] = addtoCube(x, y, z, Shape.getVert(listOne[2], -0.5f), offsetX, offsetZ);
                verts [1] = addtoCube(x, y, z, Shape.getVert(listOne[2], 0.5f), offsetX, offsetZ);
                verts [2] = addtoCube(x, y, z, Shape.getVert(listOne[1], 0.5f), offsetX, offsetZ);
                verts [3] = addtoCube(x, y, z, Shape.getVert(listOne[1], -0.5f), offsetX, offsetZ);
                break;

            case WorldTypes.Direction.south:
                /*verts [0] = addtoCube(x,y,z,Shape.getVert(listTwo[1],-0.5f),offsetX,offsetZ);
                *  verts [1] = addtoCube(x,y,z,Shape.getVert(listTwo[1],0.5f),offsetX,offsetZ);
                *  verts [2] = addtoCube(x,y,z,Shape.getVert(listTwo[2],0.5f),offsetX,offsetZ);
                *  verts [3] = addtoCube(x,y,z,Shape.getVert(listTwo[2],-0.5f),offsetX,offsetZ);*/
                verts [0] = addtoCube(x, y, z, Shape.getVert(listOne[1], -0.5f), offsetX, offsetZ);
                verts [1] = addtoCube(x, y, z, Shape.getVert(listOne[1], 0.5f), offsetX, offsetZ);
                verts [2] = addtoCube(x, y, z, Shape.getVert(listOne[2], 0.5f), offsetX, offsetZ);
                verts [3] = addtoCube(x, y, z, Shape.getVert(listOne[2], -0.5f), offsetX, offsetZ);
                break;

            case WorldTypes.Direction.west:
                /*verts [0] = addtoCube(x,y,z,Shape.getVert(listTwo[3],-0.5f),offsetX,offsetZ);
                *  verts [1] = addtoCube(x,y,z,Shape.getVert(listTwo[3],0.5f),offsetX,offsetZ);
                *  verts [2] = addtoCube(x,y,z,Shape.getVert(listTwo[0],0.5f),offsetX,offsetZ);
                *  verts [3] = addtoCube(x,y,z,Shape.getVert(listTwo[0],-0.5f),offsetX,offsetZ);*/
                verts [0] = addtoCube(x, y, z, Shape.getVert(listOne[3], -0.5f), offsetX, offsetZ);
                verts [1] = addtoCube(x, y, z, Shape.getVert(listOne[3], 0.5f), offsetX, offsetZ);
                verts [2] = addtoCube(x, y, z, Shape.getVert(listOne[0], 0.5f), offsetX, offsetZ);
                verts [3] = addtoCube(x, y, z, Shape.getVert(listOne[0], -0.5f), offsetX, offsetZ);
                break;

            case WorldTypes.Direction.east:
                /*verts [0] = addtoCube(x,y,z,Shape.getVert(listTwo[0],-0.5f),offsetX,offsetZ);
                *  verts [1] = addtoCube(x,y,z,Shape.getVert(listTwo[0],0.5f),offsetX,offsetZ);
                *  verts [2] = addtoCube(x,y,z,Shape.getVert(listTwo[3],0.5f),offsetX,offsetZ);
                *  verts [3] = addtoCube(x,y,z,Shape.getVert(listTwo[3],-0.5f),offsetX,offsetZ);*/
                verts [0] = addtoCube(x, y, z, Shape.getVert(listOne[0], -0.5f), offsetX, offsetZ);
                verts [1] = addtoCube(x, y, z, Shape.getVert(listOne[0], 0.5f), offsetX, offsetZ);
                verts [2] = addtoCube(x, y, z, Shape.getVert(listOne[3], 0.5f), offsetX, offsetZ);
                verts [3] = addtoCube(x, y, z, Shape.getVert(listOne[3], -0.5f), offsetX, offsetZ);
                break;
            }
        }

        return(verts);
    }
Пример #7
0
 public override bool isSolid(WorldTypes.Direction direction, Block inType = null)
 {
     if (inType.isSolid(direction))
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Пример #8
0
    public override Vector2[] FaceUVs(WorldTypes.Direction direction)
    {
        Vector2[] UVs      = new Vector2[4];
        float     tileSize = 1.0f / 216.0f;

        //WorldTypes.Tile tilePos = TexturePosition(direction);
        UVs[0] = new Vector2(0, (int)color * tileSize);
        UVs[1] = new Vector2(0, (int)color * tileSize);
        UVs[2] = new Vector2(0, (int)color * tileSize);
        UVs[3] = new Vector2(0, (int)color * tileSize);

        return(UVs);
    }
Пример #9
0
    public virtual Vector2[] FaceUVs(WorldTypes.Direction direction)
    {
        Vector2[]       UVs      = new Vector2[4];
        WorldTypes.Tile tilePos  = TexturePosition(direction);
        float[]         tileSize = GetTileSizes();
        UVs[0] = new Vector2(tileSize[0] * tilePos.x,
                             (tileSize[1] * tilePos.y) + 0.02f);
        UVs[1] = new Vector2(tileSize[0] * tilePos.x,
                             (tileSize[1] * tilePos.y + tileSize[1]) - 0.02f);
        UVs[2] = new Vector2(tileSize[0] * tilePos.x + tileSize[0],
                             (tileSize[1] * tilePos.y + tileSize[1]) - 0.02f);
        UVs[3] = new Vector2(tileSize[0] * tilePos.x + tileSize[0],
                             (tileSize[1] * tilePos.y) + 0.02f);

        return(UVs);
    }
Пример #10
0
 public override WorldTypes.Tile TexturePosition(WorldTypes.Direction direction)
 {
     WorldTypes.Tile tile = new WorldTypes.Tile();
     if (direction == WorldTypes.Direction.up || direction == WorldTypes.Direction.down)
     {
         tile.x = GetRandom(0, 3.9f);
         //	tile.x = 0;
         tile.y = 3;
     }
     else
     {
         tile.x = GetRandom(1, 2.9f);
         tile.y = 2;
     }
     return(tile);
 }
Пример #11
0
 public override WorldTypes.Tile TexturePosition(WorldTypes.Direction direction)
 {
     WorldTypes.Tile tile = new WorldTypes.Tile();
     if (direction == WorldTypes.Direction.up || direction == WorldTypes.Direction.down)
     {
         //	tile.x =  1 - Random.Range(1,3);
         tile.x = 2;
         tile.y = 1;
     }
     else
     {
         tile.x = 1;
         tile.y = 1;
     }
     return(tile);
 }
Пример #12
0
    public Vector3[] CreateHighlightWall(float x, float y, float z, WorldTypes.Direction direction)
    {
        Vector3 [] verts = new Vector3[4];
        switch (direction)
        {
        case WorldTypes.Direction.down:
            verts [0] = addtoCube(x, y, z, Shape.getVert(0, -0.5f));
            verts [1] = addtoCube(x, y, z, Shape.getVert(4, -0.5f));
            verts [2] = addtoCube(x, y, z, Shape.getVert(24, -0.5f));
            verts [3] = addtoCube(x, y, z, Shape.getVert(20, -0.5f));
            break;

        case WorldTypes.Direction.north:
            verts [0] = addtoCube(x, y, z, Shape.getVert(4, -0.5f));
            verts [1] = addtoCube(x, y, z, Shape.getVert(4, 0.5f));
            verts [2] = addtoCube(x, y, z, Shape.getVert(0, 0.5f));
            verts [3] = addtoCube(x, y, z, Shape.getVert(0, -0.5f));
            break;

        case WorldTypes.Direction.south:
            verts [0] = addtoCube(x, y, z, Shape.getVert(20, -0.5f));
            verts [1] = addtoCube(x, y, z, Shape.getVert(20, 0.5f));
            verts [2] = addtoCube(x, y, z, Shape.getVert(24, 0.5f));
            verts [3] = addtoCube(x, y, z, Shape.getVert(24, -0.5f));
            break;

        case WorldTypes.Direction.west:
            verts [0] = addtoCube(x, y, z, Shape.getVert(0, -0.5f));
            verts [1] = addtoCube(x, y, z, Shape.getVert(0, 0.5f));
            verts [2] = addtoCube(x, y, z, Shape.getVert(20, 0.5f));
            verts [3] = addtoCube(x, y, z, Shape.getVert(20, -0.5f));
            break;

        case WorldTypes.Direction.east:
            verts [0] = addtoCube(x, y, z, Shape.getVert(24, -0.5f));
            verts [1] = addtoCube(x, y, z, Shape.getVert(24, 0.5f));
            verts [2] = addtoCube(x, y, z, Shape.getVert(4, 0.5f));
            verts [3] = addtoCube(x, y, z, Shape.getVert(4, -0.5f));
            break;
        }
        return(verts);
    }
Пример #13
0
 public override Vector3 [] MakeShape(float x, float y, float z, WorldTypes.Direction direction, float size = 1.0f, int placement = 1, int rotation = 0)
 {
     return(CreateWorldCube(x, y, z, direction));
 }
Пример #14
0
 public override bool isSolid(WorldTypes.Direction direction, Block inType = null)
 {
     return(false);
 }
Пример #15
0
 public virtual bool isSolid(WorldTypes.Direction direction, Block inType = null)
 {
     return(true);
 }
Пример #16
0
 public virtual Vector3 [] MakeShape(float x, float y, float z, WorldTypes.Direction direction, float size = 1.0f, int placement = 1, int rotation = 0)
 {
     return(new Vector3[] { new Vector3(x, y, z) });
 }
Пример #17
0
 public virtual Vector3 [] Create(float x, float y, float z, WorldTypes.Direction direction)
 {
     return(new Vector3[] { new Vector3(x, y, z) });
 }