public static void SavePlayer(PlayerManager playerManager)
        {
            byte[] bytes = MessagePackSerializer.Serialize(playerManager);
            File.WriteAllBytes(PATH + playerManager.PlayerIdentifier.ToString() + ".bin", bytes);

            PlayerPersistenceMetaData metaData = GetPlayerPersistenceMetaData(playerManager.PlayerIdentifier);

            metaData.Level = playerManager.Level;
            SaveMetaData();
        }
        public static void DeletePlayer(int playerIdentifier)
        {
            File.Delete(PATH + playerIdentifier.ToString() + ".bin");
            PlayerPersistenceMetaData toDelete = default;

            foreach (PlayerPersistenceMetaData metaData in MetaData)
            {
                if (metaData.PlayerIdentifier == playerIdentifier)
                {
                    toDelete = metaData;
                }
            }
            MetaData.Remove(toDelete);
            SaveMetaData();
        }
        public static int CreatePlayer(string name, float color, DeathPenaltyType deathPenalty)
        {
            PlayerPersistenceMetaData newMetaData = new PlayerPersistenceMetaData
            {
                PlayerIdentifier = NextAvailableIdentifier(),
                Version          = "alpha 0.7",
                Name             = name,
                Level            = 1,
                DeathPenalty     = deathPenalty,
                Color            = color,
            };

            MetaData.Add(newMetaData);
            SaveMetaData();

            PlayerManager newPlayer = new PlayerManager(newMetaData.PlayerIdentifier, newMetaData.Name, newMetaData.Color, newMetaData.DeathPenalty);

            SavePlayer(newPlayer);
            return(newPlayer.PlayerIdentifier);
        }