17 lines
415 B
GDScript3
17 lines
415 B
GDScript3
|
extends Node
|
||
|
|
||
|
class_name GameInstance
|
||
|
|
||
|
onready var ui = $CanvasLayer/ui as GameUI
|
||
|
onready var world = $world as GameWorld
|
||
|
|
||
|
func _ready():
|
||
|
ui.connect("command", world, "process_command")
|
||
|
|
||
|
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]
|