mirror of
https://github.com/cyberarm/i-mic-rts.git
synced 2025-12-14 07:12:34 +00:00
Orders are now de/serializable, and scheduleable, Entities now show a circle around themselves when selected and draw a line to their target
This commit is contained in:
18
lib/orders/camera_move.rb
Normal file
18
lib/orders/camera_move.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
IMICRTS::Order.define_handler(IMICRTS::Order::CAMERA_MOVE, arguments: [:player_id, :x, :y, :zoom]) do |order, director|
|
||||
director.player(order.player_id).camera.move_to(order.x, order.y, order.zoom)
|
||||
end
|
||||
|
||||
IMICRTS::Order.define_serializer(IMICRTS::Order::CAMERA_MOVE) do |order, director|
|
||||
# Order ID: char as C
|
||||
# Player ID: char as C
|
||||
# Position X/Y: Double as G
|
||||
# Zoom: Double as G
|
||||
|
||||
[IMICRTS::Order::CAMERA_MOVE, order.player_id, order.x, order.y, order.zoom].pack("CCGGG")
|
||||
end
|
||||
|
||||
IMICRTS::Order.define_deserializer(IMICRTS::Order::CAMERA_MOVE) do |string, director|
|
||||
# Player ID | Camera X | Camera Y | Camera Zoom
|
||||
# char | double | double | double
|
||||
string.unpack("CGGG")
|
||||
end
|
||||
Reference in New Issue
Block a user