add base system
This commit is contained in:
26
core/photo_mode/collection_manager.gd
Normal file
26
core/photo_mode/collection_manager.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
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
|
||||
Reference in New Issue
Block a user