AI part 6

pull/28/head
Sascha 2025-08-22 09:58:52 +07:00
parent 3beac6a586
commit 4eb4dc1810
4 changed files with 45 additions and 45 deletions

@ -6,20 +6,9 @@
<component name="ChangeListManager">
<list default="true" id="c3091895-9cbd-4d08-bc3f-599dc2d3e86d" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scenes/game.tscn" beforeDir="false" afterPath="$PROJECT_DIR$/scenes/game.tscn" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/enemy.gd" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/enemy.gd" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/enemy_overlay.gd" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/enemy_overlay.gd" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/game_manager.gd" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/game_manager.gd" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/player.gd" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/player.gd" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/rogue.gd" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/rogue.gd" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/audio_manager.gd" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/audio_manager.gd" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/enemies_ui_manager.gd" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/enemies_ui_manager.gd" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/spawn_manager.gd" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/spawn_manager.gd" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/spawn_point.gd" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/spawn_point.gd" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/survivor_male_b.gd" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/survivor_male_b.gd.uid" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/target.gd" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/target.gd" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/ui.gd" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/ui.gd" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/unit.gd" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/unit.gd" afterDir="false" />
<change beforePath="$PROJECT_DIR$/scripts/wall_doorway.gd" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/wall_doorway.gd" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -51,21 +40,23 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;GdScript Start and Debug.Player GDScript.executor&quot;: &quot;Debug&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
&quot;gdscript.promo.shown&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;range__weapons&quot;,
&quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.build.godotPlugin&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"GdScript Start and Debug.Player GDScript.executor": "Debug",
"Notification.DisplayName-DoNotAsk-GodotSupportNotificationGroupId": "Godot LSP",
"Notification.DoNotAsk-GodotSupportNotificationGroupId": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.git.unshallow": "true",
"gdscript.promo.shown": "true",
"git-widget-placeholder": "range__weapons",
"ignore.virus.scanning.warn.message": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"settings.editor.selected.configurable": "preferences.build.godotPlugin",
"vue.rearranger.settings.migration": "true"
}
}</component>
}]]></component>
<component name="RunManager" selected="GdScript Start and Debug.Player GDScript">
<configuration name="Player GDScript" type="GDSCRIPT_DEBUG_RUN_CONFIGURATION" factoryName="GdScriptRunFactory" show_console_on_std_err="false" show_console_on_std_out="false" port="6006">
<option name="address" value="127.0.0.1" />
@ -99,8 +90,19 @@
<option name="presentableId" value="Default" />
<updated>1733914913603</updated>
<workItem from="1733914927162" duration="262000" />
<workItem from="1755703701834" duration="1959000" />
<workItem from="1755703701834" duration="2144000" />
<workItem from="1755849033123" duration="59000" />
<workItem from="1755849134118" duration="393000" />
</task>
<task id="LOCAL-00001" summary="AI part 5">
<option name="closed" value="true" />
<created>1755705842073</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1755705842073</updated>
</task>
<option name="localTasksCounter" value="2" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -110,13 +112,13 @@
<component name="UnityProjectConfiguration" hasMinimizedUI="false" />
<component name="VcsManagerConfiguration">
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
<MESSAGE value="AI part 5" />
<option name="LAST_COMMIT_MESSAGE" value="AI part 5" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<default-breakpoints>
<breakpoint enabled="true" type="GDSCRIPT_EXCEPTION_BP_TYPE">
<properties exception="GdScript Exception" />
</breakpoint>
<breakpoint enabled="true" type="GDSCRIPT_EXCEPTION_BP_TYPE" />
</default-breakpoints>
</breakpoint-manager>
</component>

@ -1,18 +1,17 @@
extends Node
@onready var background_music_player: AudioStreamPlayer = $BackgroundMusic
@onready var voice_player: AudioStreamPlayer = $Voice
func _on_player_game_over() -> void:
# Signal-Handler bleibt für Godot-Verbindungen unverändert und delegiert an die Fachlogik.
_play_game_over_voice()
play_if_idle(voice_player)
func _play_game_over_voice() -> void:
func play_if_idle(player: AudioStreamPlayer) -> void:
# Guard Clauses: sichere und idempotente Ausführung
if voice_player == null:
if player == null:
return
if voice_player.playing:
if player.playing:
return
voice_player.play()
player.play()

@ -1,30 +1,29 @@
extends Node
const ENEMY_UI_SCENE: PackedScene = preload("res://packed-scenes/enemy_ui.tscn")
@export var enemies_ui_container: VBoxContainer
@onready var spawn_manager: Node = $"../SpawnManager"
const ENEMY_UI_SCENE: PackedScene = preload("res://packed-scenes/enemy_ui.tscn")
func _ready() -> void:
spawn_manager.enemy_ui_ready = true
func update_enemies_ui(enemies: Array[Enemy]) -> void:
_clear_enemy_ui_container()
func rebuild_enemy_ui(enemies: Array[Enemy]) -> void:
_clear_enemy_ui()
if enemies.is_empty():
return
for enemy in enemies:
var enemy_ui: Node = _instantiate_enemy_ui(enemy)
var enemy_ui: Node = _create_enemy_ui_instance(enemy)
enemies_ui_container.add_child(enemy_ui)
func _clear_enemy_ui_container() -> void:
func _clear_enemy_ui() -> void:
for child in enemies_ui_container.get_children():
child.queue_free()
func _instantiate_enemy_ui(enemy: Enemy) -> Node:
func _create_enemy_ui_instance(enemy: Enemy) -> Node:
var ui: Node = ENEMY_UI_SCENE.instantiate()
ui.enemy = enemy
return ui

@ -96,7 +96,7 @@ func register_enemy(new_enemy: Enemy, spawn_point: SpawnPoint) -> void:
func update_enemies_ui() -> void:
if enemies_ui_manager != null and enemy_ui_ready:
enemies_ui_manager.update_enemies_ui(current_enemies)
enemies_ui_manager.rebuild_enemy_ui(current_enemies)
func find_empty_spawn_points() -> Array[SpawnPoint]: