You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
802 B
GDScript

extends Control
@onready var weapon_item_list = [$Weapon1,$Weapon2,$Weapon3,$Weapon4,$Weapon5]
var duration : float
func _process(delta):
if visible:
duration -= delta
if duration <= 0:
visible = false
var weapon_list : Array
var weapon_index_list = [0,0,0,0,0]
func on_weapon_list_changed(list:Array):
weapon_list = list
func on_weapon_index_changed(index:int):
for i in range(5):
weapon_index_list[i] = (i + index + len(weapon_list) - 2) % len(weapon_list)
update_weapon()
func update_weapon():
if visible:
pass
else:
for i in range(5):
var weapon_item_sub = weapon_item_list[i] as WeaponItemSub
var weapon_cfg = weapon_list[weapon_index_list[i]] as WeaponCfg
weapon_item_sub.set_texture(weapon_cfg.icon)
visible = true
duration = Setting.weapon_hide_duration