From 84365b6f901a9c0251a9f724a8d9f81a3787e97d Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 3 Nov 2024 14:10:07 +0100 Subject: next commit --- Towers/Components/BurnComponent.gd | 1 + Towers/Components/FrostComponent.gd | 1 + Towers/Components/TowerComponent.gd | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+) (limited to 'Towers/Components') 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 -- cgit v1.2.3