This repository has been archived on 2020-09-30. You can view files and clone it, but cannot push or open issues or pull requests.
2020-07-13 20:18:02 +00:00
|
|
|
extends Node
|
|
|
|
|
2020-09-15 23:23:45 +00:00
|
|
|
class_name GameSystems
|
|
|
|
|
2020-07-13 20:18:02 +00:00
|
|
|
func serialize() -> Dictionary:
|
2020-09-15 23:23:45 +00:00
|
|
|
var systems := {}
|
2020-07-13 20:18:02 +00:00
|
|
|
for child in get_children():
|
|
|
|
systems[child.name] = {
|
|
|
|
"script": child.script.resource_path,
|
|
|
|
"data": child.serialize()
|
|
|
|
}
|
|
|
|
return systems
|
|
|
|
|
|
|
|
func deserialize(data: Dictionary) -> void:
|
|
|
|
for system_name in data:
|
2020-09-15 23:23:45 +00:00
|
|
|
var system_data := data[system_name] as Dictionary
|
2020-07-13 20:18:02 +00:00
|
|
|
var system_node = load(system_data.script).new()
|
|
|
|
system_node.name = system_name
|
|
|
|
add_child(system_node, true)
|
|
|
|
system_node.deserialize(system_data.data)
|