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) ⇒ StrobeFlash



108
109
110
111
112
113
114
115
116
# File 'lib/doom/game/sector_effects.rb', line 108

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

Instance Method Details

#updateObject



118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/doom/game/sector_effects.rb', line 118

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