school-game/godot/Finances.gd

32 lines
857 B
GDScript3
Raw Normal View History

2022-11-09 12:09:17 +00:00
extends Node
@onready var player_vars = get_node("/root/PlayerVariables")
@onready var game_time = get_node("/root/GameTimer")
2022-11-09 12:09:17 +00:00
# Called when the node enters the scene tree for the first time.
func _ready():
# game_time.connect("heartbeat", self, "_on_heartbeat")
game_time.connect("month_heartbeat", Callable(self, "_on_month_heartbeat"))
2022-11-09 12:09:17 +00:00
# game_time.connect("season_heartbeat", self, "_on_season_heartbeat")
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
#func _on_heartbeat():
# pass
func _on_month_heartbeat():
player_vars.funds += player_vars.pupils_income
player_vars.funds -= player_vars.salary_cost
player_vars.funds -= player_vars.operating_costs
player_vars.salary_cost = 0
player_vars.pupils_income = 0
player_vars.operating_costs = 0
#func _on_season_heartbeat():
# pass