scenes
This commit is contained in:
+12
-2
@@ -4,10 +4,12 @@ extends Node
|
||||
const BOAT_SCENE := preload("res://boat.tscn")
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("restart"):
|
||||
if event.is_action_pressed(&"restart"):
|
||||
get_tree().reload_current_scene()
|
||||
if event.is_action_pressed(&"debug_spawn_boat"):
|
||||
if event.is_action_pressed(&"debug_spawn_boat") and _is_in_mission():
|
||||
_debug_spawn_boat()
|
||||
if event.is_action_pressed(&"debug_end_mission") and _is_in_mission():
|
||||
GameState.return_to_hub({"outcome": "aborted"})
|
||||
|
||||
func _debug_spawn_boat() -> void:
|
||||
var focus := get_tree().get_first_node_in_group(&"boats") as Node3D
|
||||
@@ -17,4 +19,12 @@ func _debug_spawn_boat() -> void:
|
||||
boat.position = focus.global_position + focus.global_basis.x * 10.0 + Vector3.UP * 2.0
|
||||
else:
|
||||
boat.position = Vector3(0, 3, 0)
|
||||
|
||||
var ai := AIController.new()
|
||||
ai.name = "AIController"
|
||||
boat.add_child(ai)
|
||||
get_tree().current_scene.add_child(boat, true)
|
||||
|
||||
func _is_in_mission() -> bool:
|
||||
var scene := get_tree().current_scene
|
||||
return scene != null and scene.is_in_group(&"mission")
|
||||
|
||||
Reference in New Issue
Block a user