Ejemplo n.º 1
0
    /// <summary>
    /// Add new element into data collection
    /// </summary>
    public void Add(IColorInventoryItem inventoryItem)
    {
        if (inventoryItem is ColorInventoryItem == false)
        {
            Debug.LogError("wrong type, Need 'ColorInventoryItem'");
            return;
        }

        ColorInventoryItem colorInventoryItem = (inventoryItem as ColorInventoryItem);

        colorInventorySystemData.items.Add(colorInventoryItem);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// remove element from data collection
    /// </summary>
    public void Remove(IColorInventoryItem inventoryItem)
    {
        if (inventoryItem is ColorInventoryItem == false)
        {
            Debug.LogError("wrong type, Need 'ColorInventoryItem'");
            return;
        }

        ColorInventoryItem colorInventoryItem = (inventoryItem as ColorInventoryItem);

        if (colorInventorySystemData.items.Contains(colorInventoryItem) == false)
        {
            Debug.LogWarning("system doen't contains this item");
            return;
        }

        colorInventorySystemData.items.Remove(colorInventoryItem);
        colorInventoryItem.SelfDestroy();
    }