55 lines
1.5 KiB
GDScript
55 lines
1.5 KiB
GDScript
extends Control
|
|
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)
|
|
|
|
func _on_day_pass_pressed():
|
|
|
|
await $AnimationPlayer.animation_finished
|
|
$AnimationPlayer.play("recharge_fade_out")
|
|
await $AnimationPlayer.animation_finished
|
|
|
|
func _on_planet_updated(planet:Planet):
|
|
%DayCount.text = "Day " + str(planet.day) + "/" + str(planet.day_limit)
|
|
%DecontaminationCoverage.text = str(roundi(planet.decontamination_surface)) + " m2"
|
|
|
|
|
|
func _on_player_action_tried_without_energy():
|
|
$AnimationPlayer.play("no_energy_left")
|
|
|
|
|
|
func _on_pause_pressed():
|
|
pause_asked.emit()
|
|
|
|
|
|
func _on_player_upgraded():
|
|
$EffectAnimation.play("upgrade")
|
|
|
|
func _on_planet_pass_day_started(planet):
|
|
$PassDayAnimation.speed_scale = 1/(planet.PASS_DAY_ANIMATION_TIME)
|
|
$PassDayAnimation.play("pass_day")
|
|
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
|
|
$NoEnergyLeftAnimation.play("no_energy_left_appear")
|
|
elif energy != 0 and %NoEnergyLeft.visible:
|
|
%NoEnergyLeft.visible = false
|