Hexbgon: Rewrite

Looks like I’m going to have to do a massive rewrite.  By trying to do things in a simple way, I screwed myself.  I have a mix of GameObjects and Vector3s (Position) for moving to locations and detecting if objects exist.  However, now that I’m trying to do a less targeted approach, the mix of Vector3s and GameObjects is making it confusing and stupid.

So – I have to refigure all the code in a way that my brain just doesn’t feel like doing right now.  It’s kind of a bummer.  I was on such a roll.  Oh well.

It doesn’t help that I’ve been playing the hell out of Heroes of the Storm.

Hexbgon: Wild Honey Redux

So – I’m trying to get the “Wild” honey drops powerup (which allows you to move to any hex on the board), and am having issues with the callback triggered by clicking on the honey icon in the UI detecting the click of the honey icon (not the click AFTER the honey icon).  I kept trying to think about how to resolve this issue.  Somehow ignore that click and then accept the click after that, but it felt hacky.

But on my way to work today I realized that what I need to do is revamp my entire code for how legitimate targets are detected.  The problem being that I coded a very specific method of detecting valid targets based upon the non-powered up valid moves.  What I need to do is genericize it, make the hexagons have a “valid_target” flag.  Then all I need to do is check whether the hex is a valid target.  I don’t need to do all these complicated math.

Once I do that, I can set the method that determines whether a hex is a valid target or not as the callback method, then proceed to detect clicks like normal.

This means that when the callback is fired, it has nothing to do with detecting input (and thus, the click that started it), but will process the hexes and make them all valid targets.

This will actually clean up the logic of the code in the process and do a better job of compartmentalizing things, I think.

I knew this “working from the particular to the general” would come back to bite me in the ass.