private void Reset() { Console.WriteLine("FullReset"); if (ActiveMapClass != null) { ActiveMapClass.Dispose(); ActiveMapClass = null; } PunishmentsLoaded = false; HasConnectedToGame = false; errorsFound = false; }
public void LoadActiveMap(Map map, Vector3 _offset, bool isWrapping = false) { Dictionary <string, List <MapEntry> > innerMap = map.GetMap(); Dictionary <int, List <Vector3> > layers = new Dictionary <int, List <Vector3> >(); Dictionary <Vector3, List <MapEntry> > activeMap = new Dictionary <Vector3, List <MapEntry> >(new Vector3Comparer()); foreach (string key in innerMap.Keys) { Vector3 newKey = key.StringToVector3(); int z = (int)newKey.z; activeMap.Add(newKey, innerMap[key]); if (layers.ContainsKey(z)) { layers[z].Add(newKey); } else { layers.Add(z, new List <Vector3>() { newKey }); } } int size = 0; foreach (int i in layers.Keys) { // I HAVE NO IDEA HOW TO INDENT THIS (pretty sure i'm not supposed to do it like that though) layers[i].Sort( delegate(Vector3 a, Vector3 b) { if (a.z < b.z) { return(-1); } else if (a.z == b.z) { return(0); } else { return(1); } } ); if (i > size) { size = i; } } ActiveMapClass newActiveMapClass = new ActiveMapClass(activeMap, _offset, layers, size, isWrapping); ActiveMaps.AddLast(newActiveMapClass); Debug.Log("New active map loaded : total = " + ActiveMaps.Count); // DO the requirement thing to load enough objects }