20 lines
479 B
GDScript
20 lines
479 B
GDScript
extends Node
|
|
|
|
class_name GameInstance
|
|
|
|
onready var ui = $CanvasLayer/ui
|
|
onready var world = $world as GameWorld
|
|
onready var systems = $systems
|
|
|
|
func _ready():
|
|
randomize()
|
|
|
|
ui.connect("command", world, "process_command")
|
|
$world/runtime.queue_free()
|
|
|
|
func process_command(cmd: UICommand):
|
|
match cmd.cmd_type:
|
|
UICommand.CommandType.SetShipSpeed:
|
|
world.map.ship_speed = cmd.cmd_args[0]
|
|
UICommand.CommandType.SetShipDirection:
|
|
world.map.ship_direction = cmd.cmd_args[0]
|