-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
226 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
extends SelectionContext | ||
class_name MovementContext | ||
|
||
func move_selected_units(m_pos: Vector2) -> void: | ||
var result = _player_camera.raycast_from_mouse() | ||
if result: | ||
print_debug("Command: Move selected units {0} ".format([result])) | ||
for unit in _player_camera.selected_entities: | ||
if unit.faction == _player_camera.player.faction: | ||
unit.move_to(Utils.map_3_to_2(result.position)) | ||
func move_selected_units_to(position) -> void: | ||
#print_debug("Command: Move selected units {0} ".format([result])) | ||
print("Command: Move selected units to ", position) | ||
for unit in _player_camera.selected_entities: | ||
if unit.faction == _player_camera.player.faction: | ||
#unit.move_to(round(Vector2(position.x + 0.5, position.y + 0.5))) | ||
#unit.move_to(Vector2(position.x + 1, position.y + 1)) | ||
unit.move_to(Vector2(position)) | ||
|
||
func _on_ia_main_command_pressed(target: Node, position: Vector2) -> void: | ||
#print_debug("Move action") | ||
|
||
var m_pos = get_viewport().get_mouse_position() | ||
move_selected_units(m_pos) | ||
if not target is AStarMap: | ||
print(target) # TODO: Interact with different entity (e.g. attack) | ||
else: | ||
move_selected_units_to(position) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.