Show unit facing on battlefield

This commit is contained in:
2026-06-19 19:29:56 +09:00
parent 3427116513
commit b01995db00
4 changed files with 93 additions and 5 deletions

View File

@@ -135,6 +135,24 @@ func _check_scene_pixel_facing(failures: Array[String]) -> void:
failures.append("pixel facing should use player facing_x")
if scene._unit_pixel_facing(enemy) != 1:
failures.append("pixel facing should use enemy facing_x")
if scene._unit_facing_text(player) != "서쪽":
failures.append("unit facing text should localize west-facing units")
if scene._unit_facing_text(enemy) != "동쪽":
failures.append("unit facing text should localize east-facing units")
var marker_rect := Rect2(Vector2(12.0, 20.0), Vector2(scene.TILE_SIZE, scene.TILE_SIZE))
var left_points: PackedVector2Array = scene._unit_facing_marker_points(marker_rect, player)
var right_points: PackedVector2Array = scene._unit_facing_marker_points(marker_rect, enemy)
if left_points.size() != 3 or right_points.size() != 3:
failures.append("unit facing marker should draw a compact triangular marker")
elif left_points[0].x >= left_points[1].x or right_points[0].x <= right_points[1].x:
failures.append("unit facing marker should point toward the unit facing: left=%s right=%s" % [str(left_points), str(right_points)])
var closed_points: PackedVector2Array = scene._closed_polyline_points(left_points)
if closed_points.size() != 4 or closed_points[0] != closed_points[3]:
failures.append("unit facing marker outline should close the triangle: %s" % str(closed_points))
var marker_color: Color = scene._unit_facing_marker_fill_color(player, Color(0.2, 0.4, 0.8, 1.0))
if marker_color.a <= 0.0:
failures.append("unit facing marker fill should be visible")
scene.unit_action_motion_by_unit["cao_cao"] = {
"from": Vector2i(4, 3),