51 lines
1.6 KiB
GDScript
51 lines
1.6 KiB
GDScript
extends Node
|
|
|
|
@onready var player_vars = get_node("/root/PlayerVariables")
|
|
var classroomteacher = preload("res://CTeacher.tscn")
|
|
@onready var game_time = get_node("/root/GameTimer")
|
|
|
|
var staff_tracker_achievement : int
|
|
var sa_pool : int
|
|
var staff_tracker_enjoyment : int
|
|
var se_pool : int
|
|
var staff_tracker_wellbeing : int
|
|
var sw_pool : int
|
|
var staff_tracker_total : int
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
game_time.connect("heartbeat", Callable(self, "on_heartbeat"))
|
|
staff_tracker_achievement = 50
|
|
staff_tracker_enjoyment = 50
|
|
staff_tracker_wellbeing = 50
|
|
staff_tracker_total = 50
|
|
# game_time.connect("month_heartbeat", self, "on_month_heartbeat")
|
|
|
|
func add_teacher():
|
|
if player_vars.teacher_pop < player_vars.classroom_count:
|
|
if player_vars.funds > (player_vars.teacher_hire - 1):
|
|
var teacher_agent = classroomteacher.instantiate()
|
|
add_child(teacher_agent)
|
|
player_vars.funds -= player_vars.teacher_hire
|
|
player_vars.teacher_pop += 1
|
|
|
|
func _on_AddTeacher_pressed():
|
|
add_teacher()
|
|
|
|
func on_heartbeat():
|
|
player_vars.teacher_pop = get_child_count()
|
|
|
|
staff_tracker()
|
|
|
|
func staff_tracker():
|
|
if sa_pool > 0 && staff_tracker_achievement < 100:
|
|
staff_tracker_achievement += (sa_pool / player_vars.teacher_pop)
|
|
if se_pool > 0 && staff_tracker_enjoyment < 100:
|
|
staff_tracker_enjoyment += (se_pool / player_vars.teacher_pop)
|
|
if sw_pool > 0 && staff_tracker_wellbeing < 100:
|
|
staff_tracker_wellbeing += (sw_pool / player_vars.teacher_pop)
|
|
sa_pool = 0
|
|
sw_pool = 0
|
|
se_pool = 0
|
|
staff_tracker_total = int(float(staff_tracker_achievement * 0.5 + staff_tracker_enjoyment * 0.2 + staff_tracker_wellbeing * 0.3))
|