* pleins de choses et j'ai pas le temps * mais en gros * le détecteur détecte les cellules * ajout du sprite de Demeter * ajout d'une limite dans la map * la recharge ne peut plus de nouveau être utilisée après la fin de la région
36 lines
868 B
GDScript
36 lines
868 B
GDScript
extends Interactable
|
|
class_name TruckRecharge
|
|
|
|
func _ready():
|
|
if region:
|
|
update()
|
|
|
|
func update():
|
|
%EnergyTextContainer.modulate = (
|
|
Color.WHITE if region.data.charges > 0 and region.data.state == RegionData.State.IN_PROGRESS
|
|
else Color.RED )
|
|
%EnergyText.text = str(region.data.charges)
|
|
if not region.data.pass_day_ended.is_connected(update):
|
|
region.data.pass_day_ended.connect(update)
|
|
|
|
func can_interact(_p : Player) -> bool:
|
|
return (
|
|
region != null
|
|
and region.data
|
|
and region.data.charges > 0 and region.data.state == RegionData.State.IN_PROGRESS
|
|
)
|
|
|
|
func interact(_p: Player) -> bool:
|
|
|
|
if can_interact(_p):
|
|
region.data.charges -= 1
|
|
region.pass_day()
|
|
|
|
update()
|
|
|
|
return true
|
|
return false
|
|
|
|
func get_card_up_padding() -> float:
|
|
return 100
|