2022-11-09 12:09:17 +00:00
|
|
|
extends Node
|
|
|
|
|
2023-03-29 12:32:57 +00:00
|
|
|
@onready var player_vars = get_node("/root/PlayerVariables")
|
2022-11-09 12:09:17 +00:00
|
|
|
var classroom_agent = preload("res://Rooms/Classroom.tscn")
|
|
|
|
var staffroom_agent = preload("res://Rooms/StaffRoom.tscn")
|
|
|
|
var cpdroom_agent = preload("res://Rooms/CPDRoom.tscn")
|
|
|
|
|
|
|
|
# Repeatable Buildings
|
|
|
|
|
|
|
|
func add_classroom():
|
|
|
|
if player_vars.funds > (player_vars.classroom_cost - 1):
|
2023-03-29 12:32:57 +00:00
|
|
|
var classroom = classroom_agent.instantiate()
|
2022-11-09 12:09:17 +00:00
|
|
|
add_child(classroom)
|
|
|
|
player_vars.funds -= player_vars.classroom_cost
|
|
|
|
player_vars.classroom_count += 1
|
|
|
|
|
|
|
|
func add_staffroom():
|
|
|
|
if player_vars.has_staffroom == false:
|
|
|
|
if player_vars.funds > (player_vars.staffroom_cost - 1):
|
2023-03-29 12:32:57 +00:00
|
|
|
var staffroom = staffroom_agent.instantiate()
|
2022-11-09 12:09:17 +00:00
|
|
|
add_child(staffroom)
|
|
|
|
player_vars.funds -= player_vars.staffroom_cost
|
|
|
|
player_vars.has_staffroom = true
|
|
|
|
|
|
|
|
# Unique Buildings
|
|
|
|
|
|
|
|
func add_cpdroom():
|
|
|
|
if player_vars.has_cpdroom == false:
|
|
|
|
if player_vars.funds > (player_vars.cpdroom_cost - 1):
|
2023-03-29 12:32:57 +00:00
|
|
|
var cpdroom = cpdroom_agent.instantiate()
|
2022-11-09 12:09:17 +00:00
|
|
|
add_child(cpdroom)
|
|
|
|
player_vars.funds -= player_vars.cpdroom_cost
|
|
|
|
player_vars.has_cpdroom = true
|
|
|
|
|
|
|
|
func _on_ClassroomButton_pressed():
|
|
|
|
add_classroom()
|
|
|
|
|
|
|
|
func _on_StaffroomButton_pressed():
|
|
|
|
add_staffroom()
|
|
|
|
|
|
|
|
func _on_CPDRoomButton_pressed():
|
|
|
|
add_cpdroom()
|