26 lines
602 B
GDScript
26 lines
602 B
GDScript
extends Node2D
|
|
|
|
const UNLOCK_GOAL_ID: StringName = &"gold_50M_food_5M_wood_5M"
|
|
|
|
@onready var _sprite: Sprite2D = $Sprite2D
|
|
@onready var _area: Area2D = $Area2D
|
|
@onready var _game_state: LevelGameState = find_parent("LevelGameState")
|
|
|
|
|
|
func _ready() -> void:
|
|
_sprite.visible = false
|
|
_area.monitoring = false
|
|
_game_state.goal_completed.connect(_on_goal_completed)
|
|
if _game_state.is_goal_completed(UNLOCK_GOAL_ID):
|
|
_unlock()
|
|
|
|
|
|
func _on_goal_completed(goal_id: StringName) -> void:
|
|
if goal_id == UNLOCK_GOAL_ID:
|
|
_unlock()
|
|
|
|
|
|
func _unlock() -> void:
|
|
_sprite.visible = true
|
|
_area.monitoring = true
|