29 lines
804 B
GDScript
29 lines
804 B
GDScript
class_name EnvironmentManager
|
|
extends Node3D
|
|
|
|
var player_hands: Dictionary[int, PlayerHandAssociation]
|
|
var _own_client_id: String
|
|
@export var own_player_hand: PlayerHand
|
|
|
|
@export var player_hand_scene: PackedScene
|
|
|
|
func _on_web_client_tcp_client_order_received(client_ids: Array[String]) -> void:
|
|
for index in client_ids.size():
|
|
if client_ids[index] == _own_client_id:
|
|
player_hands[index] = PlayerHandAssociation.new(
|
|
_own_client_id,
|
|
own_player_hand.get_path(),
|
|
)
|
|
else:
|
|
var hand: PlayerHand = player_hand_scene.instantiate()
|
|
|
|
# TODO
|
|
self.add_child(hand) # needs position!
|
|
player_hands[index] = PlayerHandAssociation.new(
|
|
client_ids[index],
|
|
hand.get_path(),
|
|
)
|
|
|
|
func _on_web_client_tcp_received_client_id(client_id: String) -> void:
|
|
_own_client_id = client_id
|