Add dumb label to power station

This commit is contained in:
Daniel Snider 2022-08-13 19:16:01 -07:00
parent afe0a5d39c
commit 89d4d3a29c
2 changed files with 12 additions and 4 deletions

View File

@ -17,4 +17,8 @@ coins_required = 0
[node name="MeshInstance" type="MeshInstance" parent="."]
mesh = SubResource( 1 )
[node name="CointCount" type="Label3D" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0275149, 0.721019, 1.58046 )
billboard = 1
[connection signal="coin_requirement_met" from="coin_machine" to="." method="_on_coin_machine_coin_requirement_met"]

View File

@ -3,11 +3,15 @@ extends Spatial
export var max_charge_capacity : int = 1
export var time_to_generate : float = 120
var current_holding : int = 0
var current_holding : int = 0 setget set_current_holding
var current_timer : float = 0
func set_current_holding(new_value):
current_holding = new_value
$CointCount.text = "Charge Count: %d" % current_holding
func _ready():
pass # Replace with function body.
set_current_holding(current_holding)
func _process(delta):
current_timer += delta
@ -18,12 +22,12 @@ func _process(delta):
func generate_charge():
if current_holding >= max_charge_capacity:
return
current_holding += 1
self.current_holding += 1
print("power station: charge generated")
func collect_charges_from_station():
var charges_to_return : int = current_holding
current_holding = 0
self.current_holding = 0
return charges_to_return
func _on_coin_machine_coin_requirement_met(player):