2026-10-18 22:58:58 -05:00
|
|
|
class_name Jet extends CharacterBody3D
|
2026-10-18 14:56:21 -05:00
|
|
|
|
|
|
|
|
|
2026-10-18 22:58:58 -05:00
|
|
|
@export_enum(
|
|
|
|
|
"Allies:0",
|
|
|
|
|
"Axis:1",
|
|
|
|
|
"Neutral:2"
|
|
|
|
|
) var faction: int
|
2026-10-18 14:56:21 -05:00
|
|
|
|
2026-11-06 21:08:21 -06:00
|
|
|
@onready var target_ray: RayCast3D = $target_ray
|
2026-10-18 14:56:21 -05:00
|
|
|
@onready var camera: Camera3D = $camera
|
|
|
|
|
@onready var controller: JetController = $controller
|
2026-11-06 21:08:21 -06:00
|
|
|
@onready var strategy_stack: StrategyStack = $strategy_stack
|
2026-10-18 14:56:21 -05:00
|
|
|
|
2026-10-18 22:58:58 -05:00
|
|
|
var control_frame: BaseJet = null
|
2026-10-25 23:12:51 -05:00
|
|
|
var target: Jet = null
|
|
|
|
|
var targeted_by: Jet = null
|
2026-11-15 00:29:26 -06:00
|
|
|
var target_direction: Vector3 = Vector3.ZERO
|
2026-10-18 22:58:58 -05:00
|
|
|
|
2026-10-18 14:56:21 -05:00
|
|
|
|
|
|
|
|
func _ready() -> void:
|
2026-10-18 17:18:59 -05:00
|
|
|
pass
|
2026-10-18 14:56:21 -05:00
|
|
|
|
2026-11-06 18:00:33 -06:00
|
|
|
func _process(delta: float) -> void:
|
2026-11-05 20:47:05 -06:00
|
|
|
var action: Globals.CompoundCommand = controller.process(delta)
|
2026-10-18 22:58:58 -05:00
|
|
|
if action:
|
|
|
|
|
control_frame.do_action(action, delta, self)
|
2026-11-15 00:29:26 -06:00
|
|
|
controller.cpu.no_action()
|
|
|
|
|
controller.player.no_action()
|
2026-10-18 22:58:58 -05:00
|
|
|
|
2026-11-06 18:00:33 -06:00
|
|
|
func _physics_process(_delta: float) -> void:
|
2026-10-19 21:27:46 -05:00
|
|
|
velocity = -transform.basis.z * control_frame.speed
|
2026-10-18 22:58:58 -05:00
|
|
|
move_and_slide()
|
2026-10-18 14:56:21 -05:00
|
|
|
|
2026-10-18 22:58:58 -05:00
|
|
|
func set_model(model: Node) -> void:
|
2026-10-18 17:18:59 -05:00
|
|
|
add_child(model)
|
2026-10-18 16:06:22 -05:00
|
|
|
|
2026-10-18 22:58:58 -05:00
|
|
|
func set_as_player() -> void:
|
2026-10-18 14:56:21 -05:00
|
|
|
camera.current = true
|
2026-10-25 16:22:34 -05:00
|
|
|
controller.control_mode = Globals.ControlMode.PLAYER_MODE
|
2026-10-18 14:56:21 -05:00
|
|
|
|
2026-10-18 22:58:58 -05:00
|
|
|
func set_as_cpu() -> void:
|
2026-10-18 14:56:21 -05:00
|
|
|
camera.current = false
|
2026-10-25 16:22:34 -05:00
|
|
|
controller.control_mode = Globals.ControlMode.CPU_MODE
|