The Timer class defines the necessary data to keep track of timers for objects
Constructor for a Timer object.
id
The id of the object
name
The symbol that defines the kind of timer event.
time
Optional information needed to process the event.
return
A reference to the Timer.
# File lib/engine/timer.rb, line 25 def initialize(id,name,time) @id,@name,@time,@counter=id,name,time,time end
# File lib/engine/timer.rb, line 29 def fire? @counter -= 1 @counter < 1 end
# File lib/engine/timer.rb, line 34 def reset @counter = @time end