public async Task Reconnect()
 {
     if (colyseusManager != null)
     {
         DestroyPlayers();
         colyseusManager.ConnectToServer();
         await colyseusManager.CreateRoom("game", null);
     }
 }
    // Start is called before the first frame update
    async Task Start()
    {
        colyseusManager = GameObject.FindObjectOfType <ColyseusManager>();
        audioManager    = GameObject.FindObjectOfType <AudioManager>();

        colyseusManager.ConnectToServer();
        await colyseusManager.CreateRoom("game");

        timeLeft = 60 * 4;

        colyseusManager.PlayerAdded += (sender, player) =>
        {
            var playerPrefab = GetPlayerPrefab(player);

            if (playerPrefab != null)
            {
                if (playerObjects.ContainsKey(player.name))
                {
                    Destroy(playerObjects[player.name]);
                    playerObjects.Remove(player.name);
                }

                var spawnPoint = GetNextSpawnPoint();

                if (spawnPoint == null)
                {
                    Debug.LogError("No spawn point found");
                    return;
                }

                var playerObject = Instantiate(playerPrefab, spawnPoint.transform.position, Quaternion.identity);

                playerObjects.Add(player.name, playerObject);

                var playerScript = playerObject.GetComponent <PlayerController>();

                playerScript.player = player;

                audioManager.PlaySoundEffect(SoundEffectType.PlayerSpawn);

                if (playerObjects.Count == 1)
                {
                    StartGame(60 * 3); // Play for 3 minutes...
                }
                else
                {
                    Debug.Log($"Player joined '{player.name}'");
                }
            }
        };

        colyseusManager.PlayerRemoved += (sender, player) =>
        {
            if (playerObjects.ContainsKey(player.name))
            {
                Destroy(playerObjects[player.name]);
                playerObjects.Remove(player.name);

                Debug.Log($"Removed player '{player.name}'");
            }
        };

        colyseusManager.LeftRoom += code =>
        {
            foreach (var player in playerObjects)
            {
                Destroy(player.Value);
            }

            playerObjects.Clear();
        };
    }