Example #1
0
    private GameObject GenerateMesh(int gx, int gy)
    {
        //int b = BOXSIZE - ( gx != 0 ? 0 : 0 );
        //int h = BOXSIZE - ( gy != 0 ? 0 : 0 );

        int numfloats = (1 + (BOXSIZE-1) * BOXES);

        GameObject groundMesh;

        float[][] meshbox = new float[BOXSIZE][];
        for (int i = 0; i < BOXSIZE; i++) meshbox[i] = new float[BOXSIZE];

        float[][] meshbox2 = new float[numfloats][];
        for (int i = 0; i < meshbox2.Length; i++) meshbox2[i] = new float[numfloats];

        if (otherway) {

            int mid = (BOXES-1)/2;

            for (int i = 0; i < BOXES; i++) {
                for (int j = 0; j < BOXES; j++) {

                    ConnectionHandler c1 = new ConnectionHandler();
                    c1.get_block_datao(j - mid, i - mid, meshbox2, i * (BOXSIZE-1), j * (BOXSIZE-1));

                }
            }

            groundMesh = WeaveMaster(gx, gy, meshbox2);

        }
        else {

            ConnectionHandler c1 = new ConnectionHandler();
            c1.get_block_data(gx, gy, meshbox);

            groundMesh = WeaveMaster(gx, gy, meshbox);

        }

        groundMesh.AddComponent<GroundMesh>();
        groundMesh.GetComponent<GroundMesh>().gX = gx;
        groundMesh.GetComponent<GroundMesh>().gY = gy;
        localCoordinates.Add(new Vector2(gx,gy),groundMesh);
        PlaceGroundMeshGXGY(groundMesh,gx,gy);

        return groundMesh;
    }