示例#1
0
    /**
     * Call this to generate out the full terrain.
     */
    public override void GenerateMap()
    {
        Vector3 cameraPos = Camera.main.transform.position;

        base.GenerateMap();

        //Block stoneBlock = Map.Instance.GetBlockByIndex (11);
        for (int i = -1 * LAND_SIZE; i <= LAND_SIZE; i++)
        {
            for (int j = -1 * LAND_SIZE; j <= LAND_SIZE; j++)
            {
                if (Mathf.Abs(i) >= LAND_SIZE - 3 || Mathf.Abs(j) >= LAND_SIZE - 3)
                {
                    GenerateBlock((int)(cameraPos.x + i), LAND_SIZE - Mathf.Max(Mathf.Abs(i), Mathf.Abs(j)), (int)(cameraPos.z + j), 0);
                }
                else
                {
                    Generate((int)(cameraPos.x + i), (int)(cameraPos.z + j));
                }
            }
        }


        //Door insert
        for (int xPlus = 0; xPlus < 2; xPlus++)
        {
            for (int yPlus = 0; yPlus < 3; yPlus++)
            {
                MapBuilderHelper.BuildBlock("Door", -4 + xPlus, 6 - yPlus, -25);
            }
        }
    }
示例#2
0
    //This function is called to generate out the map
    public override void GenerateMap()
    {
        for (int x = worldSize * -1; x < worldSize; x++)
        {
            for (int z = worldSize * -1; z < worldSize; z++)
            {
                int height = 0;
                int depth  = 0;

                if (Mathf.Abs(x) < centralPowerSize && Mathf.Abs(z) < centralPowerSize && x != 0 && z != 0)
                {
                    //make central thing
                    for (int y = 10; y >= -5; y--)
                    {
                        MapBuilderHelper.BuildBlock("Crystal", x, y, z);
                    }
                }
                else
                {
                    for (int y = height; y > -5; y--)
                    {
                        MapBuilderHelper.BuildBlock("SnowBlock", x, y, z);

                        depth += 1;
                    }
                }
            }
        }
    }
示例#3
0
    //Helper method to generate a specific block for a given distance
    private void GenerateBlock(int worldX, int worldY, int worldZ, int deep)
    {
        string block = GetBlock(worldX, worldY, worldZ, deep);

        if (block != null)
        {
            MapBuilderHelper.BuildBlock(block, worldX, worldY, worldZ);
        }
    }
示例#4
0
    //Make the cave
    public override void GenerateMap()
    {
        for (int x = -worldSize; x <= worldSize; x++)
        {
            for (int z = -worldSize; z <= worldSize; z++)
            {
                if (Mathf.Abs(x) <= caveSize && Mathf.Abs(z) <= caveSize)
                {
                    int height = 0;

                    if (Mathf.Abs(x) > 4)
                    {
                        height = Mathf.Abs(x) / 2 - 1;
                    }
                    if (Mathf.Abs(z) > 4)
                    {
                        height = Mathf.Abs(z) / 2 - 1;
                    }

                    if (caveSize == Mathf.Abs(x) || caveSize == Mathf.Abs(z))
                    {
                        height = 10;
                    }

                    while (height > -5)
                    {
                        MapBuilderHelper.BuildBlock("Stone2", x, height, z);
                        height -= 1;
                    }

                    MapBuilderHelper.BuildBlock("Stone2", x, 10, z);
                }
                else
                {
                    //Dirt area outside of cave
                    if (Mathf.Abs(x) < worldSize - 2 && Mathf.Abs(z) < worldSize - 2)
                    {
                        MapBuilderHelper.BuildBlock("Grass", x, 3, z);
                    }
                    else
                    {
                        MapBuilderHelper.BuildBlock("Grass", x, 2, z);
                    }
                }
            }
        }

        //CreateDoor
        for (int xPlus = 0; xPlus < 2; xPlus++)
        {
            for (int yPlus = 0; yPlus < 3; yPlus++)
            {
                MapBuilderHelper.BuildBlock("Door", -1 + xPlus, 6 - yPlus, 10);
            }
        }
    }
示例#5
0
 public void BuildCube(string type, int x, int y, int z, int sizeX, int sizeY, int sizeZ)
 {
     for (int xi = 0; xi < sizeX; xi++)
     {
         for (int yi = 0; yi < sizeY; yi++)
         {
             for (int zi = 0; zi < sizeZ; zi++)
             {
                 MapBuilderHelper.BuildBlock(type, x + xi, y + yi, z + zi);
             }
         }
     }
 }
    void BuildRectangle(int x, int y, int z, int sizeX, int sizeY, string stringVal)
    {
        int bX = 0;

        while (bX < sizeX)
        {
            int bZ = 0;
            while (bZ < sizeY)
            {
                MapBuilderHelper.BuildBlock(stringVal, bX + x, y, bZ + z);
                bZ = bZ + 1;
            }
            bX = bX + 1;
        }
    }
示例#7
0
 //This function is called to generate out the map
 public override void GenerateMap()
 {
     MapBuilderHelper.BuildBlock("Grass", 0, 0, 0);
 }