Wednesday, November 16, 2016

Basic Hex Map

Not much work today. Created a method that should generate a basic hexagonal field of hexagons. Haven't been able to test out if this properly works yet, but it's based on the hexagon article linked in a previous post.

My next step is to be able to render the hexagons (create Unity objects?), thus also testing whether the generating works properly. After this I'll add height variation and we'll see where that leads us.

private void Generate()
{
    int range = 5;
 
    for (int i = -range; i <= range; i++)
    {
        for (int j = Math.Max(-range, -- range); j < Math.Min(range, -+ range); j++)
        {
            var k = -- j;
 
            _map.Add(HexCoord.ToString(i, j, k), new HexTile(i, j, k));
        }
    }
}

No comments:

Post a Comment