As I discussed at the end of my last journal entry, I have a Trello card, called “Allow Clickable Turn Order GUI”. Well, I finally got around to addressing it, and it turned out to be pretty easy.

So what was I attempting to do, you ask? Well, since I want to eventually support larger battlefield, which would result in more units, I figured it would be nice if while looking at the Turn Order GUI if you could click on the portrait of the unit, and have the camera pan to them, while also highlighting the area they can move to. Nothing revolutionary, I know, but something that I really wanted to get done.

It turned out to be pretty easy because I already had built in functions to do the following:

  • Pan the camera to a specific unit

  • Highlight the tiles a unit can move to

The majority of the work was implementing “Mouse Pointer Click” events for the individual portraits, which underneath the hood, or standard Unity UI Image components. I created my own class, TurnOrderImage, and implemented said events, and within a half hour or so, wired everything up.

While I was working on this, other ideas started coming to. The portrait the player is hovering over should be highlighted. Or maybe increase in size by 5% or so, so it’s clear it’s the one being hovered over. I started going down that rabbit hole, but the end result ended up with the possibility of creating custom shaders, and other things I just didn’t have the time to deal with. So I just left this as is.

What’s next? Well, the only card I have left has to do with writing unit tests for 5 classes. It’s nothing glamorous, but I am about to start working on some simple enemy unit AI, and all of these classes will play a part in it. So, I might as well get them fully tested, as I’ll be making tons of changes, and I don’t feel like breaking a bunch of shit, and not knowing until much later.

Till tomorrow…