Squashed commit
This commit is contained in:
parent
c713781de4
commit
c3d8ff6989
14 changed files with 308 additions and 120 deletions
|
|
@ -36,6 +36,11 @@ var _quota_threshold := 0
|
|||
var _quota_filled_style: StyleBoxFlat
|
||||
var _quota_empty_style: StyleBoxFlat
|
||||
|
||||
var _idle_image: TextureRect
|
||||
var _static_overlay: ColorRect
|
||||
var _score_label: Label
|
||||
var _score_value := 0
|
||||
|
||||
@onready var _pulse = $Pulse
|
||||
|
||||
signal pulse_started(duration: float)
|
||||
|
|
@ -90,6 +95,42 @@ func _ready():
|
|||
EventBus.floor_changed.connect(_update_floor_label)
|
||||
EventBus.people_changed.connect(_update_quota_dots)
|
||||
|
||||
_idle_image = TextureRect.new()
|
||||
_idle_image.texture = load("res://images/goatech_screen.png")
|
||||
_idle_image.texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST
|
||||
_idle_image.anchor_right = 1.0
|
||||
_idle_image.anchor_bottom = 1.0
|
||||
_idle_image.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
_idle_image.visible = false
|
||||
add_child(_idle_image)
|
||||
|
||||
_static_overlay = ColorRect.new()
|
||||
_static_overlay.color = Color(1.0, 1.0, 1.0, 0.6)
|
||||
_static_overlay.anchor_right = 1.0
|
||||
_static_overlay.anchor_bottom = 1.0
|
||||
_static_overlay.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
_static_overlay.visible = false
|
||||
add_child(_static_overlay)
|
||||
|
||||
_score_label = Label.new()
|
||||
_score_label.add_theme_font_size_override("font_size", 12)
|
||||
_score_label.add_theme_color_override("font_color", Color(0.2, 1, 0.2, 1))
|
||||
_score_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
||||
_score_label.anchor_left = 0.0
|
||||
_score_label.anchor_right = 1.0
|
||||
_score_label.anchor_top = 0.0
|
||||
_score_label.anchor_bottom = 0.0
|
||||
_score_label.offset_top = QUOTA_DOT_Y + QUOTA_DOT_SIZE + 2
|
||||
_score_label.offset_bottom = QUOTA_DOT_Y + QUOTA_DOT_SIZE + 18
|
||||
_score_label.offset_right = -QUOTA_DOT_RIGHT_MARGIN
|
||||
_score_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
_score_label.visible = false
|
||||
_score_label.text = "SCORE: 0"
|
||||
add_child(_score_label)
|
||||
EventBus.score_changed.connect(_on_score_changed)
|
||||
|
||||
enter_idle()
|
||||
|
||||
func start(floor_num: int = EventBus.STARTING_FLOOR):
|
||||
active = true
|
||||
$AIFace.text = ">:)"
|
||||
|
|
@ -186,6 +227,10 @@ func _update_quota_dots(count: int, threshold: int):
|
|||
var style = _quota_filled_style if i < count else _quota_empty_style
|
||||
_quota_dots[i].add_theme_stylebox_override("panel", style)
|
||||
|
||||
func _on_score_changed(new_score: int):
|
||||
_score_value = new_score
|
||||
_score_label.text = "SCORE: " + str(new_score)
|
||||
|
||||
func _update_perfect_zone():
|
||||
var bz = $TargetZone
|
||||
var width = bz.size.x * PERFECT_ZONE_RATIO
|
||||
|
|
@ -235,6 +280,7 @@ func flash(color: Color):
|
|||
_flash_tween.tween_property(style, "bg_color", base_color, 0.3)
|
||||
|
||||
func show_countdown():
|
||||
$AIFace.visible = true
|
||||
stop()
|
||||
$AIFace.text = "3"
|
||||
var tween = create_tween()
|
||||
|
|
@ -243,15 +289,17 @@ func show_countdown():
|
|||
tween.tween_interval(0.6)
|
||||
tween.tween_callback(func(): $AIFace.text = "1")
|
||||
tween.tween_interval(0.6)
|
||||
tween.tween_callback(func(): $AIFace.text = "CLOSED")
|
||||
tween.tween_callback(func(): $AIFace.text = "")
|
||||
|
||||
func show_win():
|
||||
$AIFace.visible = true
|
||||
stop()
|
||||
$TargetZone.visible = false
|
||||
$AIFace.text = "ESCAPED"
|
||||
flash(Color.GREEN)
|
||||
|
||||
func show_loss(message: String):
|
||||
$AIFace.visible = true
|
||||
stop()
|
||||
$TargetZone.visible = false
|
||||
$AIFace.text = message
|
||||
|
|
@ -268,6 +316,30 @@ func end_onboarding():
|
|||
$AIFace.size = Vector2(size.x, 30)
|
||||
$TargetZone.visible = true
|
||||
|
||||
func enter_idle() -> void:
|
||||
_idle_image.visible = true
|
||||
$AIFace.visible = false
|
||||
$TargetZone.visible = false
|
||||
$SweepLine.visible = false
|
||||
_static_overlay.visible = false
|
||||
_score_label.visible = true
|
||||
move_child(_score_label, get_child_count() - 1)
|
||||
|
||||
func enter_static() -> void:
|
||||
move_child(_static_overlay, get_child_count() - 1)
|
||||
_static_overlay.visible = true
|
||||
block_zone_moving = false
|
||||
_score_label.visible = false
|
||||
|
||||
func enter_hacked() -> void:
|
||||
_idle_image.visible = false
|
||||
$AIFace.visible = true
|
||||
$TargetZone.visible = true
|
||||
_static_overlay.visible = false
|
||||
_score_label.visible = false
|
||||
block_zone_moving = block_zone_speed > 0.0
|
||||
launch_pulse()
|
||||
|
||||
func _start_ready_pulse():
|
||||
if _ready_pulse_tween:
|
||||
_ready_pulse_tween.kill()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue