basic ECS spawner
This commit is contained in:
9
GECS/components/c_health.gd
Normal file
9
GECS/components/c_health.gd
Normal 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
|
||||
1
GECS/components/c_health.gd.uid
Normal file
1
GECS/components/c_health.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bg653v2p104l1
|
||||
15
GECS/components/c_spawn_point.gd
Normal file
15
GECS/components/c_spawn_point.gd
Normal 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
|
||||
1
GECS/components/c_spawn_point.gd.uid
Normal file
1
GECS/components/c_spawn_point.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cmflg422miab6
|
||||
7
GECS/components/c_transform.gd
Normal file
7
GECS/components/c_transform.gd
Normal 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
|
||||
1
GECS/components/c_transform.gd.uid
Normal file
1
GECS/components/c_transform.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c4ihfoefv2vwd
|
||||
7
GECS/components/c_velocity.gd
Normal file
7
GECS/components/c_velocity.gd
Normal 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
|
||||
1
GECS/components/c_velocity.gd.uid
Normal file
1
GECS/components/c_velocity.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cnqotfu7xgxwa
|
||||
Reference in New Issue
Block a user