Added spawn controller; added collision shape to jet; added yaw left to cpu default to test spawnning
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
class_name SpawnController extends Node
|
||||
|
||||
|
||||
@export var jet_factory: JetFactory
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
spawn_sides()
|
||||
|
||||
|
||||
func spawn_sides() -> void:
|
||||
spawn_allies_jet()
|
||||
spawn_axis_jet()
|
||||
|
||||
func spawn_neutral_jet():
|
||||
var _jet = spawn_jet(
|
||||
Globals.Faction.NEUTRAL, jet_factory.create_cpu_jet
|
||||
)
|
||||
|
||||
func spawn_allies_jet():
|
||||
var _jet = spawn_jet(
|
||||
Globals.Faction.ALLIES, jet_factory.create_cpu_jet
|
||||
)
|
||||
|
||||
func spawn_axis_jet():
|
||||
var _jet = spawn_jet(
|
||||
Globals.Faction.AXIS, jet_factory.create_cpu_jet
|
||||
)
|
||||
|
||||
func spawn_jet(faction: Globals.Faction, callback: Callable) -> Jet:
|
||||
var jet: Jet = null
|
||||
|
||||
for spawner: Spawner in get_children():
|
||||
if not spawner.faction == faction: continue
|
||||
if not spawner.is_available: continue
|
||||
|
||||
jet = callback.call(faction)
|
||||
spawner.align_to_position.call_deferred(jet)
|
||||
|
||||
return jet
|
||||
Reference in New Issue
Block a user