Its just a quibble point about topology. You are doing fine work. The wrap around in both x and y, where going around and around leads you back to the same spot (but a unique spot--ie not all going through the north pole) is the topology of a doughnut, not a sphere.
Anyway, I would like to see some rivers as hex sides, or a closest hex function (I don't care about the topology it is fine).
good work
yours
winkr7
PS
To make your work more useful you need a family, call it something like--hexPathable. If a sprite is in this family then you can do the calculations. As it is, you are using a single sprite, called unit and referring to things like unit.x. You want to make unit a member of a family and refer to things like hexPathable.x.
just a suggestion