Skip to content

TimeEvent

Adam White edited this page Aug 27, 2017 · 6 revisions

Time Events

Time events are events that happen after a certain amount of time (all times are in milliseconds). We have included various timer functions that can be used for many aspects of the game. For instance, a timer event that begins when the character builds a tower, tower upgrade times etc. TimeEvents must be registered with the EventManager to work

Creating Time Events

New time events are created by extending the TimeEvent class. The method action needs to be implemented for subclasses

Any concrete time events will also need to set the progress, reset and reset amount as necessary.

Methods:

Note that if a tick is larger than the reset amount the action may be called more than once (catchup if a tick is slow)

Method Use
action(T param) The action that is run when the event finishes or resets
setProgress(int progress) Sets time left till the event finishes
setDoReset(boolean doReset) Whether the event will reset to the reset amount when it finishes
setResetAmount(int resetAmount) The amount the event will reset to
reset() Sets the progress to the reset amount, or 0 if it will not reset
decreaseProgress(long deltaTime, T param) Used to reduce the progress of the event by an amount of time. The param is supplied to the action, if it executes

Gameplay

Design

Asset Creation

User Testing

Code Guidelines


http://cultofthepartyparrot.com/parrots/partyparrot.gifhttp://cultofthepartyparrot.com/parrots/partyparrot.gifhttp://cultofthepartyparrot.com/parrots/partyparrot.gifhttp://cultofthepartyparrot.com/parrots/partyparrot.gifhttp://cultofthepartyparrot.com/parrots/partyparrot.gif

Clone this wiki locally