Class: Doom::Game::SectorEffects::StrobeFlash

Inherits:
Object
  • Object
show all
Defined in:
lib/doom/game/sector_effects.rb

Overview

T_StrobeFlash (types 2, 3, 4, 12, 13): regular strobe blink

Instance Method Summary collapse

Constructor Details

#initialize(sector, minlight, darktime, in_sync, random) ⇒ StrobeFlash

Returns a new instance of StrobeFlash.



113
114
115
116
117
118
119
120
121
122
# File 'lib/doom/game/sector_effects.rb', line 113

def initialize(sector, minlight, darktime, in_sync, random)
  @sector = sector
  @random = random
  @maxlight = sector.light_level
  @minlight = minlight
  @minlight = 0 if @minlight == @maxlight
  @darktime = darktime
  @brighttime = STROBEBRIGHT
  @count = in_sync ? 1 : @random.rand(8) + 1
end

Instance Method Details

#updateObject



124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/doom/game/sector_effects.rb', line 124

def update
  @count -= 1
  return if @count > 0

  if @sector.light_level == @minlight
    @sector.light_level = @maxlight
    @count = @brighttime
  else
    @sector.light_level = @minlight
    @count = @darktime
  end
end