Ajout de la cinématique de début et refonte du système audio
Et toujours un peu de correction de bug par ci par là
This commit is contained in:
@@ -126,26 +126,31 @@ func try_move(move_to : Vector2):
|
||||
func pick_item(item : Item) -> Item:
|
||||
AudioManager.play_sfx("PickUp")
|
||||
if data.inventory.is_full():
|
||||
drop_item()
|
||||
await drop_item()
|
||||
|
||||
var current_item : Item = null
|
||||
|
||||
var available_slot_ind = data.inventory.get_best_available_slot_ind()
|
||||
if (
|
||||
available_slot_ind == data.inventory.current_item_ind
|
||||
&& data.inventory.items[available_slot_ind] != null
|
||||
):
|
||||
var current_item : Item = data.inventory.get_item()
|
||||
current_item = data.inventory.get_item()
|
||||
data.inventory.set_item(item, available_slot_ind)
|
||||
return current_item
|
||||
else :
|
||||
if data.inventory.set_item(item, available_slot_ind):
|
||||
data.inventory.set_current_item(available_slot_ind);
|
||||
return null
|
||||
|
||||
# Save after a timer to let the time to the item to disappear
|
||||
get_tree().create_timer(0.1).timeout.connect(region.save)
|
||||
return current_item
|
||||
|
||||
func drop_item():
|
||||
var item_to_drop = data.inventory.pop_item()
|
||||
if item_to_drop:
|
||||
terrain.drop_item(item_to_drop, global_position)
|
||||
AudioManager.play_sfx("Drop")
|
||||
region.save()
|
||||
|
||||
func delete_item(item: Item):
|
||||
data.inventory.remove_item(item)
|
||||
@@ -182,7 +187,7 @@ func use_item(item : Item):
|
||||
data.energy -= item.energy_usage
|
||||
if item.is_one_time_use():
|
||||
data.inventory.remove_item(item)
|
||||
region.save()
|
||||
get_tree().create_timer(0.1).timeout.connect(region.save)
|
||||
|
||||
func upgrade_max_energy(amount = 1):
|
||||
data.max_energy += amount
|
||||
|
||||
Reference in New Issue
Block a user