Add final progression to tiny sword, fixes and tweeks required
This commit is contained in:
@@ -1,14 +1,37 @@
|
||||
extends Node2D
|
||||
|
||||
@onready var _research_panel: ResearchPanel = $ResearchPanel
|
||||
const RESEARCH_GOAL_ID: StringName = &"gold_350k_wood_20k"
|
||||
|
||||
@onready var _research_panel: ResearchPanel = $ResearchPanel
|
||||
@onready var _sprite: Sprite2D = $Sprite2D
|
||||
@onready var _area: Area2D = $Area2D
|
||||
@onready var game_state: LevelGameState = find_parent("LevelGameState")
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
_research_panel.visible = false
|
||||
_sprite.visible = false
|
||||
_area.monitoring = false
|
||||
if game_state:
|
||||
game_state.goal_completed.connect(_on_goal_completed)
|
||||
if game_state.is_goal_completed(RESEARCH_GOAL_ID):
|
||||
_unlock()
|
||||
|
||||
|
||||
func _on_area_2d_mouse_entered() -> void:
|
||||
_research_panel.visible = true
|
||||
if game_state and game_state.is_goal_completed(RESEARCH_GOAL_ID):
|
||||
_research_panel.visible = true
|
||||
|
||||
|
||||
func _on_area_2d_mouse_exited() -> void:
|
||||
_research_panel.visible = false
|
||||
|
||||
|
||||
func _on_goal_completed(goal_id: StringName) -> void:
|
||||
if goal_id == RESEARCH_GOAL_ID:
|
||||
_unlock()
|
||||
|
||||
|
||||
func _unlock() -> void:
|
||||
_sprite.visible = true
|
||||
_area.monitoring = true
|
||||
|
||||
Reference in New Issue
Block a user