Refactor weapon system: implement WeaponHandler to manage LorentzField and prepare for additional weapons; update shader to incorporate lorentz_field uniform for visual effects.

This commit is contained in:
2026-03-29 22:22:06 +00:00
parent 3c8c481713
commit 1ea06f50d3
6 changed files with 114 additions and 20 deletions
+31
View File
@@ -0,0 +1,31 @@
require_relative 'lorentz_field'
#require_relative 'occams_razor'
#require_relative 'quantum_bow'
#require_relative 'blade_of_recursion'
class WeaponHandler
def initialize
@weapons = {
lorentz_field: LorentzField.new,
#occams_razor: OccamsRazor.new,
#quantum_bow: QuantumBow.new,
#blade_of_recursion: BladeOfRecursion.new
}
end
def update(dt)
@weapons.each_value { |weapon| weapon.update(dt) }
selected_item = $bus.get(:selected_item)
return unless @weapons.key?(selected_item)
weapon = @weapons[selected_item]
if $bus.get(:count, selected_item) > 0 && Gosu.button_down?(Gosu::KB_SPACE)
weapon.attack
end
end
def draw
@weapons.each_value(&:draw)
end
end