public bool Remove(TKey key) { if (_dictionary != null) { if (_dictionary.Contains(key)) { _dictionary.Remove(key); return(true); } else { return(false); } } #if HAVE_READ_ONLY_COLLECTIONS else if (_readOnlyDictionary != null) { throw new NotSupportedException(); } #endif else { return(GenericDictionary.Remove(key)); } }
public bool Remove(KeyValuePair <TKey, TValue> item) { if (_dictionary != null) { if (_dictionary.Contains(item.Key)) { object value = _dictionary[item.Key]; if (Equals(value, item.Value)) { _dictionary.Remove(item.Key); return(true); } else { return(false); } } else { return(true); } } #if HAVE_READ_ONLY_COLLECTIONS else if (_readOnlyDictionary != null) { throw new NotSupportedException(); } #endif else { return(GenericDictionary.Remove(item)); } }
public void AddTileType(string tileName, GameObject prototype, Material material) { var newTileType = Instantiate(prototype, transform); newTileType.GetComponent <Renderer>().material = material; newTileType.name = tileName; if (tilePrefabs.ContainsKey(tileName)) { DestroyImmediate(tilePrefabs[tileName]); tilePrefabs.Remove(tileName); } tilePrefabs.Add(tileName, newTileType); newTileType.SetActive(false); }
public void Remove(object key) { if (_dictionary != null) { _dictionary.Remove(key); } #if HAVE_READ_ONLY_COLLECTIONS else if (_readOnlyDictionary != null) { throw new NotSupportedException(); } #endif else { GenericDictionary.Remove((TKey)key); } }
public void RemoveComponent(Enums.ComponentType componentType, int entityId) { switch (componentType) { default: throw new ArgumentException("No component lists were found with the given type", "componentType"); case Enums.ComponentType.Position: positions.Remove(entityId); break; case Enums.ComponentType.Scale: scales.Remove(entityId); break; case Enums.ComponentType.Rotation: rotations.Remove(entityId); break; case Enums.ComponentType.Direction: directions.Remove(entityId); break; case Enums.ComponentType.MaxSpeed: maxSpeeds.Remove(entityId); break; case Enums.ComponentType.Movement: movementComponents.Remove(entityId); break; case Enums.ComponentType.InputToMovement: inputToMovement.Remove(entityId); break; } entityManager.entities[entityId].components.Remove(componentType); }