Class: TankHealth
- Defined in:
- lib/entities/components/tank_health.rb
Constant Summary collapse
- RESPAWN_DELAY =
5000
Instance Attribute Summary collapse
-
#health ⇒ Object
Returns the value of attribute health.
Attributes inherited from Component
Instance Method Summary collapse
-
#initialize(object, object_pool) ⇒ TankHealth
constructor
A new instance of TankHealth.
- #should_respawn? ⇒ Boolean
Methods inherited from Health
#damaged?, #dead?, #draw, #increase, #inflict_damage, #restore, #update
Methods inherited from Component
Constructor Details
#initialize(object, object_pool) ⇒ TankHealth
Returns a new instance of TankHealth.
5 6 7 |
# File 'lib/entities/components/tank_health.rb', line 5 def initialize(object, object_pool) super(object, object_pool, 100, true) end |
Instance Attribute Details
#health ⇒ Object
Returns the value of attribute health.
3 4 5 |
# File 'lib/entities/components/tank_health.rb', line 3 def health @health end |
Instance Method Details
#should_respawn? ⇒ Boolean
9 10 11 12 13 |
# File 'lib/entities/components/tank_health.rb', line 9 def should_respawn? if @death_time Gosu.milliseconds - @death_time > RESPAWN_DELAY end end |