This commit is contained in:
Marek Lenczewski
2026-03-30 22:56:58 +02:00
parent d6715e9c3f
commit 04749104a0
49 changed files with 1406 additions and 171 deletions

View File

@@ -1,12 +1,23 @@
extends StaticBody3D
const GATE_SCENE: PackedScene = preload("res://scenes/portal/gate.tscn")
func _ready() -> void:
add_to_group("portals")
EventBus.entity_died.connect(_on_entity_died)
func _on_entity_died(entity: Node) -> void:
if entity == self:
queue_free()
if entity != self:
return
var gate: Node3D = GATE_SCENE.instantiate()
gate.global_position = global_position
get_parent().add_child(gate)
var enemies := get_tree().get_nodes_in_group("enemies")
for enemy in enemies:
if is_instance_valid(enemy):
enemy.queue_free()
EventBus.portal_defeated.emit(self)
queue_free()
func _on_detection_area_body_entered(body: Node3D) -> void:
if body is CharacterBody3D and body.name == "Player":