Saturday, March 12, 2016

Timers and Interfaces

(New build is up here!)

Hi all! Just a quick update before I head out to the Game Developer's Conference this weekend. You won't see a lot different in this week's build, but timers have been rebuilt. This does mean that the timed walls on level 10 should now NEVER BE OUT OF SYNC. Hopefully that is the case.

I argued with myself over exactly how to implement an interface through which things could be timed. I now have I timable interface (which I should probably rename ITimable) which is being implemented by a "timedblink" script which is attached to default walls. A separate game object, called a Timer, has a script which takes in a public list of game objects and, on a set interval, calls the "DoEachInterval" method of any component of type timable it can find attached to any of the objects in its list of game objects.

I know that there's probably a much neater way to implement this, but for now I'll see how this is working. Switches will likely follow a similar structure, with a switchable interface attached to things I want to be able to switch on and off and also an actual switch object that the player must charge through in order to trigger.

And as always, the charging-up noise is by Javier Zumer. I'm using it under this license and have modified it.

No comments:

Post a Comment