/// <summary> /// Removes the given object from the appropriate list of MapObjects, given that the list is not null and contains the object. /// </summary> /// <param name="obj">MapObject to remove</param> public void RemoveObject(MapObject obj) { JmpType type = TypeToEnum(obj.GetType()); List <MapObject> objList = MapObjects[(int)type]; // Error out if the list is null if (objList == null) { Console.WriteLine($"Failed to remove object. Object list for type { type.ToString() } is null!"); return; } // Error out if the list doesn't contain the object we want to remove else if (!objList.Contains(obj)) { Console.WriteLine($"Failed to remove object. Object list for type { type.ToString() } doesn't contain the object to remove!"); return; } objList.Remove(obj); }