Class: Doom::Game::SectorEffects::Glow
- Inherits:
-
Object
- Object
- Doom::Game::SectorEffects::Glow
- Defined in:
- lib/doom/game/sector_effects.rb
Overview
T_Glow (type 8): smooth triangle-wave oscillation
Instance Method Summary collapse
-
#initialize(sector, minlight) ⇒ Glow
constructor
A new instance of Glow.
- #update ⇒ Object
Constructor Details
#initialize(sector, minlight) ⇒ Glow
Returns a new instance of Glow.
140 141 142 143 144 145 |
# File 'lib/doom/game/sector_effects.rb', line 140 def initialize(sector, minlight) @sector = sector @maxlight = sector.light_level @minlight = minlight @direction = -1 # start dimming end |
Instance Method Details
#update ⇒ Object
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/doom/game/sector_effects.rb', line 147 def update if @direction == -1 @sector.light_level -= GLOWSPEED if @sector.light_level <= @minlight @sector.light_level += GLOWSPEED @direction = 1 end else @sector.light_level += GLOWSPEED if @sector.light_level >= @maxlight @sector.light_level -= GLOWSPEED @direction = -1 end end end |