27 lines
847 B
GDScript
27 lines
847 B
GDScript
extends Node
|
|
|
|
signal on_collectible_unlocked(collectible_id: String)
|
|
|
|
#TODO -> assign library resource to game_state
|
|
var library: CollectibleLibrary = preload("res://core/photo_mode/collectible_library.tres")
|
|
var unlocked_ids: Array[String] = ['cane']
|
|
|
|
func unlock_photo(collectible_id: String) -> void:
|
|
if not collectible_id in unlocked_ids:
|
|
unlocked_ids.append(collectible_id)
|
|
var new_collectible = get_collectible_by_id(collectible_id)
|
|
if new_collectible:
|
|
on_collectible_unlocked.emit(collectible_id)
|
|
|
|
func get_collectible_by_id(id: String) -> CollectibleResource:
|
|
for collectible in library.collectibles:
|
|
if collectible.id == id:
|
|
return collectible
|
|
return null
|
|
|
|
func get_all_collectibles() -> Array[CollectibleResource]:
|
|
return library.collectibles
|
|
|
|
func get_unlocked_collectible_ids() -> Array[String]:
|
|
return unlocked_ids
|