class_name TowerComponent extends Resource var name: String var sprite: Sprite2D = Sprite2D.new() var level: int = 1 func set_sprite(texture: Texture2D): sprite.texture = texture sprite.texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST 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