basic ECS spawner

This commit is contained in:
2026-01-15 15:27:48 +01:00
parent 24a781f36a
commit eb737b469c
860 changed files with 58621 additions and 32 deletions

View File

@@ -0,0 +1,25 @@
[gd_scene load_steps=7 format=3 uid="uid://d0075ch03hfri"]
[ext_resource type="Script" uid="uid://ckqlc1tqyh7gm" path="res://GECS/entities/Spawner/e_spawn_point.gd" id="1_sp3sh"]
[ext_resource type="Script" uid="uid://b6k13gc2m4e5s" path="res://addons/gecs/ecs/component.gd" id="2_ksqpe"]
[ext_resource type="Script" uid="uid://cmflg422miab6" path="res://GECS/components/c_spawn_point.gd" id="3_ksqpe"]
[ext_resource type="PackedScene" uid="uid://bct6stmj0qyp2" path="res://GECS/entities/BasicEnemy/BasicEnemy.tscn" id="4_2ixog"]
[sub_resource type="Resource" id="Resource_dgltp"]
script = ExtResource("3_ksqpe")
spawn_prefab = ExtResource("4_2ixog")
metadata/_custom_type_script = "uid://cmflg422miab6"
[sub_resource type="SphereShape3D" id="SphereShape3D_sp3sh"]
[node name="SpawnPoint" type="CharacterBody3D"]
collision_layer = 0
collision_mask = 0
motion_mode = 1
script = ExtResource("1_sp3sh")
component_resources = Array[ExtResource("2_ksqpe")]([SubResource("Resource_dgltp")])
[node name="Marker3D" type="Marker3D" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_sp3sh")

View File

@@ -0,0 +1,14 @@
@tool
class_name E_SpawnPoint
extends Entity
@export var spawn_prefab: PackedScene
@export var spawn_frequency: float = -1
func on_ready():
if has_component(C_SpawnPoint):
var c_spawn_point = get_component(C_SpawnPoint) as C_SpawnPoint
if spawn_prefab != null && spawn_prefab.can_instantiate():
c_spawn_point.spawn_prefab = spawn_prefab
if spawn_frequency > 0:
c_spawn_point.spawn_frequency = spawn_frequency

View File

@@ -0,0 +1 @@
uid://ckqlc1tqyh7gm