Add quota dots to screen and color-code people count

- And try to remove survivors after doors close with queue_free
- And move panel?? Still not right.
This commit is contained in:
Jennie Robinson Faber 2026-05-11 17:23:46 +01:00
parent 0cc7611515
commit b92388cfe0
7 changed files with 43 additions and 5 deletions

View file

@ -29,6 +29,11 @@ const GLOW_PADDING := Vector2(6, 6)
const GLOW_COLOR := Color(1, 0.3, 0.3, 0.35)
const PERFECT_ZONE_RATIO := 0.3
const PERFECT_ZONE_COLOR := Color(1.0, 0.95, 0.4, 0.85)
const QUOTA_DOT_SIZE := 12.0
const QUOTA_DOT_SPACING := 8.0
const QUOTA_DOT_Y_FROM_BOTTOM := 14.0
const QUOTA_EMPTY_COLOR := Color(0.6, 0.1, 0.1, 0.95)
const QUOTA_FILLED_COLOR := Color(0.2, 1.0, 0.2, 1.0)
var base_color: Color
@ -42,6 +47,8 @@ var _face_scale_tween: Tween
var _face_shake_tween: Tween
var _flash_tween: Tween
var _floor_label: Label
var _quota_dots: Array[ColorRect] = []
var _quota_threshold := 0
signal pulse_started(duration: float)
signal pulse_blocked
@ -99,6 +106,7 @@ func _ready():
_floor_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(_floor_label)
EventBus.floor_changed.connect(_update_floor_label)
EventBus.people_changed.connect(_update_quota_dots)
func start(floor_num: int = EventBus.STARTING_FLOOR):
active = true
@ -151,6 +159,26 @@ func _update_floor_label(floor_num: int):
_displayed_floor = floor_num
UIUtils.flip_label_text(_floor_label, new_text)
func _update_quota_dots(count: int, threshold: int):
if threshold != _quota_threshold:
_quota_threshold = threshold
for dot in _quota_dots:
dot.queue_free()
_quota_dots.clear()
var total_w = threshold * QUOTA_DOT_SIZE + max(0, threshold - 1) * QUOTA_DOT_SPACING
var start_x = (size.x - total_w) / 2.0
var y = size.y - QUOTA_DOT_Y_FROM_BOTTOM
for i in threshold:
var dot = ColorRect.new()
dot.size = Vector2(QUOTA_DOT_SIZE, QUOTA_DOT_SIZE)
dot.position = Vector2(start_x + i * (QUOTA_DOT_SIZE + QUOTA_DOT_SPACING), y)
dot.color = QUOTA_EMPTY_COLOR
dot.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(dot)
_quota_dots.append(dot)
for i in _quota_dots.size():
_quota_dots[i].color = QUOTA_FILLED_COLOR if i < count else QUOTA_EMPTY_COLOR
func _update_perfect_zone():
var bz = $TargetZone
var width = bz.size.x * PERFECT_ZONE_RATIO