public static void DeleteWorld(int worldIdentifier) { File.Delete(PATH + worldIdentifier.ToString() + ".bin"); WorldPersistenceMetaData toDelete = default; foreach (WorldPersistenceMetaData metaData in MetaData) { if (metaData.WorldIdentifier == worldIdentifier) { toDelete = metaData; } } MetaData.Remove(toDelete); SaveMetaData(); }
public static int CreateWorld(string name, int seed) { WorldPersistenceMetaData newMetaData = new WorldPersistenceMetaData { WorldIdentifier = NextAvailableIdentifier(), Version = "alpha 0.7", Name = name, Seed = seed, }; MetaData.Add(newMetaData); SaveMetaData(); WorldManager newWorld = new WorldManager(newMetaData.WorldIdentifier, newMetaData.Seed); SaveWorld(newWorld); return(newWorld.WorldIdentifier); }