show hover indicator on mouse enter

This commit is contained in:
2024-10-06 06:48:31 +10:00
parent 9dafb378a2
commit 4f06f8b26b
3 changed files with 13 additions and 1 deletions

View File

@@ -20,6 +20,8 @@ func _ready() -> void:
nav_agent.max_speed = MOVE_SPEED
nav_agent.velocity_computed.connect(_on_nav_agent_velocity_computed)
set_max_slides(2)
mouse_entered.connect(_on_mouse_entered)
mouse_exited.connect(_on_mouse_exited)
func _process(delta: float) -> void:
@@ -61,7 +63,6 @@ func _click_raycast(mouse_pos: Vector2) -> Vector3:
var to := camera.project_ray_normal(mouse_pos)
return ground_plane.intersects_ray(from, to)
func _navigate() -> void:
if nav_agent.is_navigation_finished():
velocity = Vector3.ZERO
@@ -95,3 +96,11 @@ func _animate(delta: float) -> void:
func _on_nav_agent_velocity_computed(safe_velocity: Vector3) -> void:
velocity = safe_velocity
move_and_slide()
func _on_mouse_entered()->void:
set_hovered(true)
func _on_mouse_exited()->void:
set_hovered(false)