summaryrefslogtreecommitdiff
path: root/Towers/Components
diff options
context:
space:
mode:
Diffstat (limited to 'Towers/Components')
-rw-r--r--Towers/Components/BurnComponent.gd1
-rw-r--r--Towers/Components/FrostComponent.gd1
-rw-r--r--Towers/Components/TowerComponent.gd26
3 files changed, 28 insertions, 0 deletions
diff --git a/Towers/Components/BurnComponent.gd b/Towers/Components/BurnComponent.gd
index 11e9e3f..96c24f7 100644
--- a/Towers/Components/BurnComponent.gd
+++ b/Towers/Components/BurnComponent.gd
@@ -8,4 +8,5 @@ func _init() -> void:
func on_shoot(target: Unit):
var effect = preload("res://Effects/BurnEffect.tscn").instantiate()
+ effect.level = level
target.add_effect(effect)
diff --git a/Towers/Components/FrostComponent.gd b/Towers/Components/FrostComponent.gd
index d6384a7..473baf6 100644
--- a/Towers/Components/FrostComponent.gd
+++ b/Towers/Components/FrostComponent.gd
@@ -8,4 +8,5 @@ func _init() -> void:
func on_shoot(target: Unit):
var effect = preload("res://Effects/SlowEffect.tscn").instantiate()
+ effect.level = level
target.add_effect(effect)
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