diff options
Diffstat (limited to 'Towers/Components/TowerComponent.gd')
-rw-r--r-- | Towers/Components/TowerComponent.gd | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Towers/Components/TowerComponent.gd b/Towers/Components/TowerComponent.gd index 570b442..83fdc38 100644 --- a/Towers/Components/TowerComponent.gd +++ b/Towers/Components/TowerComponent.gd @@ -4,6 +4,7 @@ extends Resource var name: String var sprite: Sprite2D = Sprite2D.new() +var level: int = 1 func set_sprite(texture: Texture2D): @@ -13,3 +14,28 @@ func set_sprite(texture: Texture2D): sprite.centered = false sprite.scale = Vector2(2, 2) sprite.name = name + + + +class NetworkData extends Resource: + var name: String + var level: int + +func to_network_data() -> NetworkData: + var data = NetworkData.new() + + data.name = name + data.level = level + + return data + +func update_with_network_data(data: NetworkData): + pass + +static func from_network_data(data: NetworkData) -> TowerComponent: + var component = preload("res://Towers/Components/TowerComponent.gd").new() + + component.name = data.name + component.level = data.level + + return component |