Pagina's

Sunday, 16 June 2019

Action for actions?

Mondays,  who doesn't like 'em? The inevitability of it is quite something. I, for one, like weekends and it always gets under my skin when the weekend is over.  I usually need five days to recover and get back to normal. Mondays are the worst!

All joking aside,  this weekend has been quite productive for Holocene.  I did what I set out to do. The selection panel seems to work well. I have not yet been able to test the thing when I select at least 11 different types of units, but that's because I only have two yet. And besides,  with no box selection implemented,  who in their right mind would select that many units anyway?

With the selection panel working,  next up is showing the actions for an object. For that, I created an actions class and a display class for it. Actions are going to grow, but for now, it has a name a type (science,  recruit or special) and a prefab.  I'll first create the recruitment.  It'll just instantiate the prefab at a specific location and move it to a rally point. Should not be too difficult.

What I do think might be difficult, is how to work with these actions. The way Unity works is that to have an instance of any class be available,  one needs to make an object or a prefab of an object. I sense there might be performance issues here.

For instance,  the action "recruit a warrior" will be linked to three kinds of buildings,  meaning that warriors can be spawned by three types of buildings.  Any world object has an array of possible actions and each of these buildings will need the "recruit a warrior" one, so I'll make a game object, add the action script to it, fill out the variables and link it to the buildings.

In no time,  I'll have many objects not doing anything but just being there. To me, that seems like a waste of resources.  Is this really a problem? Are there other ways?

No comments:

Post a Comment