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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
class_name Player
extends Node
var id: int:
set(value):
id = value
name = str(value)
var current_team_name: String:
set(value):
current_team_name = value
multiplayer_synchronizer_2.set_property("current_team_name", value)
var current_move_points := 100:
set(value):
current_move_points = value
multiplayer_synchronizer_2.set_property("current_move_points", value)
var current_attack_points := 10:
set(value):
current_attack_points = value
multiplayer_synchronizer_2.set_property("current_attack_points", value)
var current_defend_points := 10:
set(value):
current_defend_points = value
multiplayer_synchronizer_2.set_property("current_defend_points", value)
var current_ability_points := 10:
set(value):
current_ability_points = value
multiplayer_synchronizer_2.set_property("current_ability_points", value)
var units: Array[Unit]
@onready var multiplayer_synchronizer_2: MultiplayerSynchronizer2 = $MultiplayerSynchronizer2
func get_color() -> Color:
var rng = RandomNumberGenerator.new()
rng.seed = id
return Color(rng.randf(), rng.randf(), rng.randf())
# current_team_name
#func set_current_team_name(value: String) -> void:
#sync_current_team_name.rpc(value)
#
#@rpc("any_peer", "call_local")
#func sync_current_team_name(value: String) -> void:
#current_team_name = value
#
#
## current_move_points
#func set_current_move_points(value: int) -> void:
#sync_current_move_points.rpc(value)
#
#@rpc("any_peer", "call_local")
#func sync_current_move_points(value: int) -> void:
#current_move_points = value
#
#
## current_attack_points
#func set_current_attack_points(value: int) -> void:
#sync_current_attack_points.rpc(value)
#
#@rpc("any_peer", "call_local")
#func sync_current_attack_points(value: int) -> void:
#current_attack_points = value
#
#
## current_defend_points
#func set_current_defend_points(value: int) -> void:
#sync_current_defend_points.rpc(value)
#
#@rpc("any_peer", "call_local")
#func sync_current_defend_points(value: int) -> void:
#current_defend_points = value
#
#
## current_ability_points
#func set_current_ability_points(value: int) -> void:
#sync_current_ability_points.rpc(value)
#
#@rpc("any_peer", "call_local")
#func sync_current_ability_points(value: int) -> void:
#current_ability_points = value
#
#
#func set_initial_values() -> void:
#if not multiplayer.is_server():
#sync_initial_values.rpc_id(1, multiplayer.get_unique_id())
#
#@rpc("any_peer", "call_remote")
#func sync_initial_values(target_id: int) -> void:
#sync_current_team_name.rpc_id(target_id, current_team_name)
#sync_current_move_points.rpc_id(target_id, current_move_points)
#sync_current_attack_points.rpc_id(target_id, current_attack_points)
|