Ejemplo n.º 1
0
        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));
            }
        }
Ejemplo n.º 2
0
        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));
            }
        }
Ejemplo n.º 3
0
    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);
    }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        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);
        }