Contrary to last post I decided, since the tiles are stationary anyway, it is better to do the conversion on creation of a HexCoord, but looking at the math it didn't seem to matter too much anyway. Ended up with a HexCoord class, and now I'm building up a HexTile class, which will include things like height, position, terrain type, etc. The rest of the hexagonal functionality code will come when I end up needing it, but for now, I need a way to store all the HexTiles.
My thinking is, since the battle grids are always going to be seemingly random in shape and size, storing the coords in an offset format in a 2D array would be wasting space. Instead I'm going to store them in a Dictionary and access them via position.
Hopefully in the next few days I have something more to show than just code, but I imagine I'll get stuck with learning how to use Unity.
public class HexCoord { public HexCoord(int x, int y, int z) { }; // Cube coord X public int X { }; // Cube coord Y public int Y { }; // Cube coord Z public int Z { }; // Axial coord Q public int Q { }; // Axial coord R public int R { }; // Offset coord column public int Column { }; // Offset coord row public int Row { }; public override string ToString() { }; }
public class HexTile { public HexCoord Position { get; set; } public int Height { get; set; } }
No comments:
Post a Comment