Class: Doom::Game::SectorEffects::FireFlicker
- Inherits:
-
Object
- Object
- Doom::Game::SectorEffects::FireFlicker
- Defined in:
- lib/doom/game/sector_effects.rb
Overview
T_FireFlicker (type 17): random fire-like flickering
Instance Method Summary collapse
-
#initialize(sector, minlight, random) ⇒ FireFlicker
constructor
A new instance of FireFlicker.
- #update ⇒ Object
Constructor Details
#initialize(sector, minlight, random) ⇒ FireFlicker
Returns a new instance of FireFlicker.
166 167 168 169 170 171 172 |
# File 'lib/doom/game/sector_effects.rb', line 166 def initialize(sector, minlight, random) @sector = sector @maxlight = sector.light_level @minlight = minlight + 16 # fire doesn't go as dark @random = random @count = 4 end |
Instance Method Details
#update ⇒ Object
174 175 176 177 178 179 180 181 182 |
# File 'lib/doom/game/sector_effects.rb', line 174 def update @count -= 1 return if @count > 0 amount = @random.rand(4) * 16 # 0, 16, 32, or 48 level = @maxlight - amount @sector.light_level = level < @minlight ? @minlight : level @count = 4 end |