90 lines
2.4 KiB
GDScript
90 lines
2.4 KiB
GDScript
class_name GameScene extends Node2D
|
|
|
|
@export var kessel: Kessel
|
|
@export var game_ui: GameUI
|
|
@export var player: Player
|
|
@export var npc_spwaner: NPC_Spawner
|
|
@export var theke: Theke
|
|
@export var round_manager: PhaseManager
|
|
|
|
@export var schwarz_blende: SchwarzBlende
|
|
|
|
signal request_level_change(next_level_path: String)
|
|
|
|
var score = 0
|
|
var social_score = 4
|
|
var info_lifes = 1
|
|
|
|
func reload_game_scene()->void:
|
|
request_level_change.emit("Game")
|
|
|
|
func load_main_menu()->void:
|
|
print("Hello")
|
|
request_level_change.emit("MainMenu")
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
theke.set_ingrediant_list.connect(enanle_order_ui)
|
|
randomize()
|
|
round_manager.start_round()
|
|
Global.game_scene = self
|
|
Global.is_in_game = true
|
|
|
|
func _process(delta: float) -> void:
|
|
print(Global.get_social_score())
|
|
if Global.get_social_score() == 0:
|
|
gameover()
|
|
|
|
## hier wird dann die game UI gezeigt
|
|
func enanle_order_ui(order_list:Array[String])->void:
|
|
game_ui.enable_order_scren(order_list)
|
|
|
|
func _on_game_ui_items_created() -> void:
|
|
game_ui.start_memorize_timer(1.0)
|
|
await get_tree().create_timer(1.0).timeout
|
|
|
|
## game over logic hinzufügen
|
|
func gameover()->void:
|
|
self.process_mode = PROCESS_MODE_DISABLED
|
|
UiManager.mainUI.show_game_over_screen("Bad Brewing. Your journey ends.")
|
|
|
|
# wenn man es unten helt
|
|
func _on_player_help_pressed(is_active:bool) -> void:
|
|
if is_active:
|
|
$Game_UI/Help_texture.show()
|
|
else:
|
|
$Game_UI/Help_texture.hide()
|
|
|
|
|
|
func _on_kessel_potion_done(list: Array[String]) -> void:
|
|
theke.set_produced_potion(list)
|
|
|
|
|
|
func _on_round_manager_new_round_start_up(customer_count: int) -> void:
|
|
game_ui.set_up_hud(customer_count)
|
|
|
|
|
|
func _on_round_manager_day_changed(count: int) -> void:
|
|
var new_day = "DAY "+ str(count)
|
|
game_ui.enable_day_label(new_day)
|
|
await get_tree().create_timer(1.5).timeout
|
|
game_ui.disable_day_label()
|
|
|
|
|
|
func _on_round_manager_shop_opens() -> void:
|
|
game_ui.enabel_shop_open_label()
|
|
await get_tree().create_timer(1.0).timeout
|
|
game_ui.diable_shop_open_label()
|
|
|
|
|
|
func _on_round_manager_start_round_change() -> void:
|
|
print( "aktivire die schwarz belnde ")
|
|
schwarz_blende.play_fade_cycle(0.8)
|
|
await schwarz_blende.fade_finished
|
|
round_manager.start_new_round.emit()
|
|
|
|
|
|
func _on_round_manager_end_game() -> void:
|
|
self.process_mode = PROCESS_MODE_DISABLED
|
|
UiManager.mainUI.show_game_over_screen("Congrats you Survived!!")
|