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,36 @@
[gd_scene load_steps=11 format=3 uid="uid://bct6stmj0qyp2"]
[ext_resource type="Script" uid="uid://ci3kmg1eck6gb" path="res://GECS/entities/BasicEnemy/e_basic_enemy.gd" id="1_h3v2l"]
[ext_resource type="Script" uid="uid://b6k13gc2m4e5s" path="res://addons/gecs/ecs/component.gd" id="2_gsgoc"]
[ext_resource type="Script" uid="uid://bg653v2p104l1" path="res://GECS/components/c_health.gd" id="3_unr0g"]
[ext_resource type="Script" uid="uid://c4ihfoefv2vwd" path="res://GECS/components/c_transform.gd" id="4_07lse"]
[ext_resource type="Script" uid="uid://cnqotfu7xgxwa" path="res://GECS/components/c_velocity.gd" id="5_vhe2b"]
[sub_resource type="Resource" id="Resource_vas4o"]
script = ExtResource("3_unr0g")
metadata/_custom_type_script = "uid://bg653v2p104l1"
[sub_resource type="Resource" id="Resource_yuljp"]
script = ExtResource("4_07lse")
metadata/_custom_type_script = "uid://c4ihfoefv2vwd"
[sub_resource type="Resource" id="Resource_6hf1n"]
script = ExtResource("5_vhe2b")
velocity = Vector3(2, 0, 0)
metadata/_custom_type_script = "uid://cnqotfu7xgxwa"
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ocib1"]
[sub_resource type="CapsuleMesh" id="CapsuleMesh_4ju8b"]
[node name="BasicEnemy" type="CharacterBody3D"]
script = ExtResource("1_h3v2l")
component_resources = Array[ExtResource("2_gsgoc")]([SubResource("Resource_vas4o"), SubResource("Resource_yuljp"), SubResource("Resource_6hf1n")])
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
shape = SubResource("CapsuleShape3D_ocib1")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
mesh = SubResource("CapsuleMesh_4ju8b")

View File

@@ -0,0 +1,10 @@
@tool
class_name BasicEnemy
extends Entity
func on_ready():
# Sync the entity's scene position to the Transform component
if has_component(C_Transform):
var c_trs = get_component(C_Transform) as C_Transform
self.global_position = c_trs.position

View File

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

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