22 lines
346 B
GDScript3
Raw Normal View History

2024-01-28 18:18:16 +00:00
class_name PlayerManager
extends Node3D
var players = {}
func _ready():
Global.players = self
func add(player: Player):
add_child(player)
players[player.id] = player
func get_player(id: String) -> Player:
return players[id] as Player
func remove(id: String):
2024-01-28 21:08:08 +00:00
if !players.has(id):
return
2024-01-28 18:18:16 +00:00
players[id].queue_free()
players.erase(id)