Pagina's

Wednesday 19 June 2019

If recruitment was this easy...

I did what I set out to do again today and it's only 11:15 pm. I set out to have a system to recruit units from a building. I know I said I'd be refactoring and I'm going to, but mañana-mañana like they say in Spain. I just wanted to have that little bit of work I was thinking about in the bus home after work. I have this actions class that I link to a building or a unit and (if it's of a recruit-unit-type) it has a game object prefab of a certain unit that we need to instantiate. That one should find out which edge of the building is nearest to the rally point and then it needs to go there.

(the bug you see here, it's been fixed. who notices it too?)


This works nicely. Now it's possible to create units indefinitely, because they have no cost, but implementing that should be easy to do. Besides, there will be a building progress to creating the unit. Right now, they pop into existence. They should do so, but not before it takes time to create the unit. For that I'll use a filler sprite that fills over time, depending on the kind of unit and possible some science-type action (which I will not implement yet).

I am quite happy about the workings of the recruit action though. It works with delegate functions that are called from the display class, because it's a button being clicked that triggers a function in the action class indirectly. It should also be easily expanded to work with different kinds of actions. It's starting to look like a game. Of course there are no challenges yet, but those will come later.

For now, have a nice evening and we'll meet again!

No comments:

Post a Comment