xiandie/scene/hud/prop_inventory.gd

20 lines
479 B
GDScript

class_name PropInventory extends Resource
@export var items := [] as Array[PropItem]
@export var current_index := 0
func add_item(name: String, prop_title: String, texture_path: String) -> void:
var item = PropItem.new()
item.name = name
item.title = prop_title
item.texture_path = texture_path
items.push_back(item)
emit_changed()
func index_wrap_add(delta: int) -> void:
current_index += delta
current_index = wrapi(current_index, 0, items.size())
emit_changed()