mirror of
https://github.com/cyberarm/i-mic-rts.git
synced 2025-12-16 00:02:33 +00:00
added on_order handler to entities and components, added visibility map
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user