Class: TankHealth

Inherits:
Health show all
Defined in:
lib/entities/components/tank_health.rb

Constant Summary collapse

RESPAWN_DELAY =
5000

Instance Attribute Summary collapse

Attributes inherited from Component

#object

Instance Method Summary collapse

Methods inherited from Health

#damaged?, #dead?, #draw, #increase, #inflict_damage, #restore, #update

Methods inherited from Component

#draw, #update

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

#healthObject

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

Returns:

  • (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