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.
134 135 136 137 138 139 |
# File 'lib/doom/game/sector_effects.rb', line 134 def initialize(sector, minlight) @sector = sector @maxlight = sector.light_level @minlight = minlight @direction = -1 # start dimming end |
Instance Method Details
#update ⇒ Object
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/doom/game/sector_effects.rb', line 141 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 |