blob: 83fdc38775e435dada3150be495140d08033c696 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
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
|