Add marketplace component for skill unlocking and update related resources

This commit is contained in:
2025-04-27 17:09:54 +02:00
parent 49a652a5b1
commit fd78f4f5b3
17 changed files with 257 additions and 13 deletions

View File

@@ -28,7 +28,6 @@ func _process(_delta: float) -> void:
return
if damage_timer:
return
process_entity_and_apply_damage(current_target)
@@ -63,6 +62,9 @@ func process_entity_and_apply_damage(body: Node2D) -> void:
func on_area2d_body_entered(body: Node2D) -> void:
current_target = body
if not check_if_processing_is_on():
return
if damage_timer:
damage_timer.start()
@@ -77,8 +79,16 @@ func on_area2d_body_exited(body: Node2D) -> void:
func on_area2d_area_entered(area: Area2D) -> void:
if not check_if_processing_is_on():
return
if area == area2d:
return
var parent := area.get_parent()
if parent.has_node("DamageComponent"):
process_entity_and_apply_damage(parent)
func check_if_processing_is_on() -> bool:
return self.process_mode == PROCESS_MODE_INHERIT or self.process_mode == PROCESS_MODE_ALWAYS

View File

@@ -6,19 +6,20 @@ extends Node
@onready var game_manager: GM = $"/root/GameManager"
func try_unlock_skill(skill_data: SkillData) -> void:
func try_unlock_skill(skill_data: SkillData) -> bool:
if not game_manager:
return
return false
if game_manager.is_skill_unlocked(skill_data.name):
return
return false
if game_manager.get_coins() < skill_data.cost:
return
return false
game_manager.remove_coins(skill_data.cost)
game_manager.unlock_skill(skill_data.name)
skill_manager.add_skill(skill_data)
return true
func _input(event: InputEvent) -> void: