Esempio n. 1
0
    /// <summary>
    /// Add a new batch of movies to the shelf.
    /// </summary>
    /// <param name="factory">
    /// A factory describing items that can be generated on the shelf.
    /// </param>
    public void Repopulate(PortableItemFactory factory)
    {
        this.inventory.Clear();
        int newItemCount = StaticRandom.Range(3, this.inventory.Capacity);

        for (int i = 0; i < newItemCount; ++i)
        {
            InventoryError err = this.inventory.Add(factory.CreateRandomItem());
            if (err != InventoryError.NoError)
            {
                Debug.LogFormat("Could not add item to movie shelf: {0}", err);
            }
        }
    }