Exemple #1
0
        /// <summary>
        /// Gets the item at the specified <paramref name="slot"/>.
        /// </summary>
        /// <param name="slot">The slot of the shop item.</param>
        /// <returns>The shop item at the specified <paramref name="slot"/>, or null if
        /// the slot was invalid or contains no item.</returns>
        public TShopItem GetShopItem(ShopItemIndex slot)
        {
            var i = slot.GetRawValue();

            if (i < 0 || i >= _shopItems.Length)
            {
                return(default(TShopItem));
            }

            return(_shopItems[i]);
        }
Exemple #2
0
        /// <summary>
        /// Gets the item info at the given <paramref name="slot"/>.
        /// </summary>
        /// <param name="slot">The slot of the item.</param>
        /// <returns>The item info at the given <paramref name="slot"/>, or null if the
        /// <see cref="slot"/> was invalid or not item was in the specified slot.</returns>
        public TItemInfo GetItemInfo(ShopItemIndex slot)
        {
            if (_items == null)
            {
                return(default(TItemInfo));
            }

            var i = slot.GetRawValue();

            if (i < 0 || i >= _items.Length)
            {
                return(default(TItemInfo));
            }

            return(_items[i]);
        }