extends CanvasLayer

signal add_currency(amount)


func _on_Add_Currency_pressed() -> void:
    emit_signal('add_currency', 1)
    return


func update_currency(amount: int) -> void:
    $Currency.set_text(String(amount))
    return


func update_health(value: int) -> void:
    $'Health Bar'.value = value
    return


func _on_weapon_slot_pressed() -> void:
    $'Weapon Selection'.set_visible(not $'Weapon Selection'.visible)
    return


func _on_select_bow_pressed() -> void:
    $'Weapon Selection/Bow'.set_visible(false)
    $'Equipped Weapon/Weapon'.set_normal_texture(
        $'Weapon Selection/Bow/Weapon'.get_normal_texture())

    $'Weapon Selection/Javelin'.set_visible(true)
    $'Weapon Selection/Staff'.set_visible(true)
    $'Weapon Selection/Sword'.set_visible(true)

    $'Weapon Selection'.set_visible(false)
    return


func _on_select_javelin_pressed() -> void:
    $'Weapon Selection/Javelin'.set_visible(false)
    $'Equipped Weapon/Weapon'.set_normal_texture(
        $'Weapon Selection/Javelin/Weapon'.get_normal_texture())

    $'Weapon Selection/Bow'.set_visible(true)
    $'Weapon Selection/Staff'.set_visible(true)
    $'Weapon Selection/Sword'.set_visible(true)

    $'Weapon Selection'.set_visible(false)
    return


func _on_select_staff_pressed() -> void:
    $'Weapon Selection/Staff'.set_visible(false)
    $'Equipped Weapon/Weapon'.set_normal_texture(
        $'Weapon Selection/Staff/Weapon'.get_normal_texture())

    $'Weapon Selection/Bow'.set_visible(true)
    $'Weapon Selection/Javelin'.set_visible(true)
    $'Weapon Selection/Sword'.set_visible(true)

    $'Weapon Selection'.set_visible(false)
    return


func _on_select_sword_pressed() -> void:
    $'Weapon Selection/Sword'.set_visible(false)
    $'Equipped Weapon/Weapon'.set_normal_texture(
        $'Weapon Selection/Sword/Weapon'.get_normal_texture())

    $'Weapon Selection/Bow'.set_visible(true)
    $'Weapon Selection/Javelin'.set_visible(true)
    $'Weapon Selection/Staff'.set_visible(true)

    $'Weapon Selection'.set_visible(false)
    return
