48 lines
1.3 KiB
GDScript
48 lines
1.3 KiB
GDScript
extends Control
|
|
class_name GameGui
|
|
|
|
signal pause_asked
|
|
|
|
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
|
|
|
|
%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
|
|
$AnimationPlayer.play("recharge_fade_out")
|
|
await $AnimationPlayer.animation_finished
|
|
|
|
func _on_planet_updated(planet:Planet):
|
|
%DayCount.text = "Day " + str(planet.day)
|
|
%DecontaminationCoverage.text = str(roundi(planet.decontamination_coverage * 100)) + "%"
|
|
|
|
|
|
func _on_player_action_tried_without_energy():
|
|
$AnimationPlayer.play("no_energy_left")
|
|
|
|
|
|
func _on_pause_pressed():
|
|
pause_asked.emit()
|
|
|
|
|
|
func _on_player_upgraded():
|
|
$AnimationPlayer.play("upgrade")
|
|
|
|
|
|
func _on_player_action_not_permitted():
|
|
$AnimationPlayer.play("not_permitted")
|
|
|
|
func _on_planet_pass_day_started(planet):
|
|
$AnimationPlayer.speed_scale = 1/(planet.PASS_DAY_ANIMATION_TIME)
|
|
$AnimationPlayer.play("pass_day")
|
|
await $AnimationPlayer.animation_finished
|
|
$AnimationPlayer.speed_scale = 1
|