Class: Brawl::Clock
- Inherits:
-
Object
- Object
- Brawl::Clock
- Defined in:
- lib/brawl/clock.rb
Instance Attribute Summary collapse
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#tick_rate ⇒ Object
readonly
Returns the value of attribute tick_rate.
-
#ticks ⇒ Object
readonly
Returns the value of attribute ticks.
Instance Method Summary collapse
-
#initialize(tick_rate = 0.05) ⇒ Clock
constructor
A new instance of Clock.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(tick_rate = 0.05) ⇒ Clock
Returns a new instance of Clock.
7 8 9 10 11 |
# File 'lib/brawl/clock.rb', line 7 def initialize(tick_rate=0.05) @tick_rate = tick_rate @state = :wait @ticks = 0 end |
Instance Attribute Details
#state ⇒ Object (readonly)
Returns the value of attribute state.
5 6 7 |
# File 'lib/brawl/clock.rb', line 5 def state @state end |
#tick_rate ⇒ Object (readonly)
Returns the value of attribute tick_rate.
5 6 7 |
# File 'lib/brawl/clock.rb', line 5 def tick_rate @tick_rate end |
#ticks ⇒ Object (readonly)
Returns the value of attribute ticks.
5 6 7 |
# File 'lib/brawl/clock.rb', line 5 def ticks @ticks end |
Instance Method Details
#start ⇒ Object
13 14 15 16 |
# File 'lib/brawl/clock.rb', line 13 def start @state = :running ticking end |
#stop ⇒ Object
18 19 20 |
# File 'lib/brawl/clock.rb', line 18 def stop @state = :stopping end |