Commit 62aa03cc authored by Gavin An's avatar Gavin An

유닛 작업 전

parent 4b394e75
...@@ -56,7 +56,6 @@ size = Vector3(0.76, 0.024, 0.06) ...@@ -56,7 +56,6 @@ size = Vector3(0.76, 0.024, 0.06)
size = Vector3(0.76, 0.024, 0.06) size = Vector3(0.76, 0.024, 0.06)
[node name="PlacementTileOverlay" type="MeshInstance3D" unique_id=824361433] [node name="PlacementTileOverlay" type="MeshInstance3D" unique_id=824361433]
visible = false
cast_shadow = 0 cast_shadow = 0
mesh = SubResource("CylinderMesh_y7kwe") mesh = SubResource("CylinderMesh_y7kwe")
script = ExtResource("1_67clr") script = ExtResource("1_67clr")
......
...@@ -9,6 +9,12 @@ const JOYSTICK_RADIUS: float = 54.0 ...@@ -9,6 +9,12 @@ const JOYSTICK_RADIUS: float = 54.0
const JOYSTICK_DEADZONE: float = 0.16 const JOYSTICK_DEADZONE: float = 0.16
const MOVE_TARGET_DISTANCE: float = 3.0 const MOVE_TARGET_DISTANCE: float = 3.0
const MOVE_COMMAND_INTERVAL: float = 0.08 const MOVE_COMMAND_INTERVAL: float = 0.08
const KEYBOARD_SKILL_SLOTS: Dictionary = {
KEY_Q: "Q",
KEY_W: "W",
KEY_E: "E",
KEY_R: "R"
}
var _hero: Node3D = null var _hero: Node3D = null
var _move_vector: Vector2 = Vector2.ZERO var _move_vector: Vector2 = Vector2.ZERO
...@@ -34,17 +40,25 @@ func _ready() -> void: ...@@ -34,17 +40,25 @@ func _ready() -> void:
visible = false visible = false
set_process(false) set_process(false)
## 키보드 공격 입력을 처리합니다. ## 키보드 공격/스킬 입력을 처리합니다.
## A 키는 화면의 ATK 버튼과 완전히 같은 _on_attack_pressed() 경로를 사용해 입력별 동작 차이를 없앱니다. ## A/Q/W/E/R 키는 화면 버튼과 같은 함수 경로를 사용해 입력별 동작 차이를 없앱니다.
func _unhandled_input(event: InputEvent) -> void: func _unhandled_input(event: InputEvent) -> void:
if not visible or not is_instance_valid(_hero) or _is_game_over(): if not visible or not is_instance_valid(_hero) or _is_game_over():
return return
if event is InputEventKey: if event is InputEventKey:
var key_event: InputEventKey = event as InputEventKey var key_event: InputEventKey = event as InputEventKey
if key_event.pressed and not key_event.echo and key_event.keycode == KEY_A: if not key_event.pressed or key_event.echo:
return
if key_event.keycode == KEY_A:
_on_attack_pressed() _on_attack_pressed()
get_viewport().set_input_as_handled() get_viewport().set_input_as_handled()
return
if KEYBOARD_SKILL_SLOTS.has(key_event.keycode):
_on_skill_pressed(KEYBOARD_SKILL_SLOTS[key_event.keycode])
get_viewport().set_input_as_handled()
func _process(delta: float) -> void: func _process(delta: float) -> void:
if not is_instance_valid(_hero) or _is_game_over(): if not is_instance_valid(_hero) or _is_game_over():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment