refonte de l'inspecteur #61

This commit is contained in:
2025-09-12 10:48:51 +02:00
parent 6687235094
commit 655b875759
16 changed files with 263 additions and 143 deletions

View File

@@ -3,19 +3,15 @@ class_name GameGui
signal pause_asked
func _ready():
Pointer.connect("inspected_entity_changed", _on_inspected_entity_changed)
func _on_player_updated(player:Player):
%EnergyCount.text = str(player.energy) + "/" + str(player.max_energy)
%EnergyInfo.modulate = Color.WHITE if player.energy > 0 else Color.RED
update_no_energy_left_info(player.energy)
%ItemInfo.visible = player.inventory.get_item() != null
if player.inventory.get_item():
var item : Item = player.inventory.get_item()
%ItemIcon.texture = item.icon
%ItemName.text = item.name
%ItemDesc.text = item.description
func _on_day_pass_pressed():
await $AnimationPlayer.animation_finished
@@ -44,6 +40,12 @@ func _on_planet_pass_day_started(planet):
await $PassDayAnimation.animation_finished
$PassDayAnimation.speed_scale = 1
func _on_inspected_entity_changed(e : InspectableEntity):
var info : Inspector.Info = null
if e:
info = e.inspector_info()
%Inspector.info = info
func update_no_energy_left_info(energy):
if energy == 0 and not %NoEnergyLeft.visible:
%NoEnergyLeft.visible = true