Basic weapon slots system

This commit is contained in:
Alexey 2025-07-26 13:56:13 +03:00
commit 22a72e572e
7 changed files with 115 additions and 15 deletions

View file

@ -0,0 +1,30 @@
extends Node3D
class_name WeaponContainer
var slots: Array[WeaponSlot]
var current_slot: WeaponSlot = null
var current_weapon: Weapon
signal slot_selected()
func _ready():
for slot in get_children():
assert(slot is WeaponSlot)
slots.push_back(slot as WeaponSlot)
for slot in range(slots.size()):
if current_slot == null:
select_slot(slot)
else:
break
assert(current_slot != null)
func select_slot(index: int):
assert(index < slots.size())
if slots[index].has_weapon:
current_slot = slots[index]
current_weapon = current_slot.weapon
print('here we go')
slot_selected.emit()