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,9 @@
class_name C_Health
extends Component
@export var current: float = 100.0
@export var maximum: float = 100.0
func _init(max_health: float = 100.0):
maximum = max_health
current = max_health

View File

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

View File

@@ -0,0 +1,15 @@
class_name C_SpawnPoint
extends Component
@export var spawn_prefab: PackedScene
@export var spawn_frequency: float = 1
var spawn_cooldown: float = 0
func _init():
pass
func should_spawn() -> bool:
return spawn_cooldown < 0
func start_spawn_cooldown() -> void:
spawn_cooldown = spawn_frequency

View File

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

View File

@@ -0,0 +1,7 @@
class_name C_Transform
extends Component
@export var position: Vector3 = Vector3.ZERO
func _init(pos: Vector3 = Vector3.ZERO):
position = pos

View File

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

View File

@@ -0,0 +1,7 @@
class_name C_Velocity
extends Component
@export var velocity: Vector3 = Vector3.ZERO
func _init(vel: Vector3 = Vector3.ZERO):
velocity = vel

View File

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