started adding player hand creation

This commit is contained in:
2025-07-08 17:40:13 +02:00
parent e0693725ea
commit 898c0d21ea
6 changed files with 71 additions and 10 deletions
+28
View File
@@ -0,0 +1,28 @@
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