41 lines
1.5 KiB
GDScript
41 lines
1.5 KiB
GDScript
extends Control
|
|
class_name RootGui
|
|
|
|
signal game_click
|
|
signal day_pass_pressed
|
|
signal day_pass_proceed
|
|
signal day_pass_finished
|
|
|
|
func _on_player_updated(player:Player):
|
|
%EnergyCount.text = str(player.energy)
|
|
|
|
%AvailableActions/GetItem.visible = player.closest_interactable is ItemObject and player.inventory.lenght() == 0
|
|
%AvailableActions/SwapItem.visible = player.closest_interactable is ItemObject and player.inventory.lenght() > 0
|
|
%AvailableActions/DropItem.visible = player.inventory.lenght() > 0
|
|
%AvailableActions/UseItem.visible = player.inventory.lenght() > 0 and player.can_use_item and not player.inventory.get_item() is SeedItem
|
|
%AvailableActions/Plant.visible = player.inventory.lenght() > 0 and player.can_use_item and player.inventory.get_item() is SeedItem
|
|
|
|
|
|
%ItemInfo.visible = player.inventory.lenght() > 0
|
|
if player.inventory.lenght() > 0:
|
|
var item : Item = player.inventory.get_item()
|
|
%ItemIcon.texture = item.icon
|
|
%ItemName.text = item.name
|
|
%ItemDesc.text = item.description
|
|
|
|
func _on_day_pass_pressed():
|
|
day_pass_pressed.emit()
|
|
$AnimationPlayer.play("recharge_fade_in")
|
|
await $AnimationPlayer.animation_finished
|
|
day_pass_proceed.emit()
|
|
$AnimationPlayer.play("recharge_fade_out")
|
|
await $AnimationPlayer.animation_finished
|
|
day_pass_finished.emit()
|
|
|
|
func _on_game_action_button_down():
|
|
game_click.emit()
|
|
|
|
func _on_planet_updated(planet:Planet):
|
|
$MarginContainer/DayCount.text = "Day " + str(planet.day)
|
|
%DecontaminationCoverage.text = str(roundi(planet.decontamination_coverage * 100)) + "%"
|