Add final progression to tiny sword, fixes and tweeks required
This commit is contained in:
25
docs/gyms/tiny_sword/buildings/barracks/barracks.gd
Normal file
25
docs/gyms/tiny_sword/buildings/barracks/barracks.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
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
|
||||
Reference in New Issue
Block a user