mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 23:52:35 +00:00
Added require_all method to replace explicitly requiring every source file, added SoundManager and sound effects, added sound for shield/health regen
This commit is contained in:
25
lib/sound_effects/shield_regen.rb
Normal file
25
lib/sound_effects/shield_regen.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
class IMICFPS
|
||||
class SoundEffect
|
||||
class ShieldRegen < SoundEffect
|
||||
def setup
|
||||
@sound = SoundManager.sound("base", :shield_regen)
|
||||
@player = @options[:player]
|
||||
|
||||
@channel = @sound.play(0.0, 0.0, true)
|
||||
end
|
||||
|
||||
def ratio
|
||||
@player.health
|
||||
end
|
||||
|
||||
def update
|
||||
@channel.speed = 0.5 + ratio / 2
|
||||
@channel.volume = 1.0 - ratio / 2
|
||||
end
|
||||
|
||||
def done?
|
||||
ratio >= 1.0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user