summaryrefslogtreecommitdiff
path: root/Towers/Components/TowerComponent.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-11-03 14:10:07 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-11-03 14:10:07 +0100
commit84365b6f901a9c0251a9f724a8d9f81a3787e97d (patch)
tree401e2bf99e6573d1d069f5044e7448067cdfb384 /Towers/Components/TowerComponent.gd
parenta43499efa6c228cea3633f9661f3ff09127bd82d (diff)
next commit
Diffstat (limited to 'Towers/Components/TowerComponent.gd')
-rw-r--r--Towers/Components/TowerComponent.gd26
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