mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
Implemented event system, Implemented initial bit of scripting system, Stubbed component system. Entities can now use the scripting system to place their 'decorations'
This commit is contained in:
@@ -5,6 +5,8 @@ class IMICFPS
|
||||
def setup
|
||||
@collision_manager = CollisionManager.new(game_state: self)
|
||||
@renderer = Renderer.new(game_state: self)
|
||||
@publisher = Publisher.new
|
||||
|
||||
@map = @options[:map]
|
||||
add_entity(Terrain.new(map_entity: @map.terrain, manifest: Manifest.new(package: @map.terrain.package, name: @map.terrain.name)))
|
||||
|
||||
@@ -85,6 +87,8 @@ class IMICFPS
|
||||
@last_frame_time = Gosu.milliseconds
|
||||
update_text
|
||||
|
||||
@publisher.publish(:tick, Gosu.milliseconds - @delta_time)
|
||||
|
||||
@collision_manager.update
|
||||
@entities.each(&:update)
|
||||
|
||||
@@ -202,6 +206,7 @@ eos
|
||||
@demo_changed = true
|
||||
end
|
||||
InputMapper.keydown(id)
|
||||
@publisher.publish(:button_down, nil, id)
|
||||
|
||||
@entities.each do |entity|
|
||||
entity.button_down(id) if defined?(entity.button_down)
|
||||
@@ -218,6 +223,7 @@ eos
|
||||
@demo_changed = true
|
||||
end
|
||||
InputMapper.keyup(id)
|
||||
@publisher.publish(:button_up, nil, id)
|
||||
|
||||
@entities.each do |entity|
|
||||
entity.button_up(id) if defined?(entity.button_up)
|
||||
|
||||
Reference in New Issue
Block a user