19 lines
313 B
GDScript3
19 lines
313 B
GDScript3
|
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):
|
||
|
players[id].queue_free()
|
||
|
players.erase(id)
|