31 lines
910 B
GDScript
31 lines
910 B
GDScript
extends Control
|
|
|
|
@onready var stamina_bar = $StaminaBar
|
|
@onready var inventory_slots_panels: Array = [$InventoryPanels/Inv1/InvSlot1, $InventoryPanels/Inv2/InvSlot2, $InventoryPanels/Inv3/InvSlot3]
|
|
var inventory: Array = [null,null,null]
|
|
|
|
var stamina: float = 100
|
|
var selected_item: int = 0
|
|
|
|
const SELECTED_COLOR = 0xcfcfcf78
|
|
const UNSELECTED_COLOR = 0x3d3d3d78
|
|
|
|
func set_stamina_bar(value:float):
|
|
stamina = value
|
|
|
|
func get_selected_item() -> PackedScene:
|
|
return inventory[selected_item]
|
|
|
|
func select_item(index: int):
|
|
inventory_slots_panels[selected_item].color = Color.hex(UNSELECTED_COLOR)
|
|
selected_item = index
|
|
inventory_slots_panels[index].color = Color.hex(SELECTED_COLOR)
|
|
|
|
func put_item(index: int, item: PackedScene):
|
|
inventory[index] = item
|
|
|
|
func _process(delta: float) -> void:
|
|
stamina_bar.value = lerpf(stamina_bar.value, stamina, delta * 5)
|
|
|
|
func set_ui_scale(scale:float) -> void:
|
|
pass
|