added on_order handler to entities and components, added visibility map

This commit is contained in:
2021-01-15 17:41:06 -06:00
parent e30d73d4d7
commit 19c5fc8d73
22 changed files with 164 additions and 51 deletions

View File

@@ -15,7 +15,7 @@ class IMICRTS
end
attr_reader :director, :player, :id, :name, :type, :data, :proto_entity
attr_accessor :position, :angle, :radius, :target, :state, :movement, :health, :max_health,
attr_accessor :position, :angle, :sight_radius, :range_radius, :radius, :target, :state, :movement, :health, :max_health,
:speed, :turret, :center, :scale, :particle_emitters, :color
def initialize(name:, player:, id:, position:, angle:, director:, proto_entity: false)
@@ -169,6 +169,18 @@ class IMICRTS
@on_tick = block
end
def on_order(&block)
@on_order = block
end
def handle_order(type, order)
@components.each do |key, comp|
comp.on_order(type, order)
end
@on_order&.call(type, order)
end
def selected_draw
draw_radius
draw_gizmos