Beispiel #1
0
        //usuwa przedmiot z plecaka
        public void RemoveItem(ItemDataAddon whichItem)
        {
            ItemDataAddon existingItem = null;

            foreach (ItemDataAddon it in _items)
            {
                if (it.Type == whichItem.Type)
                {
                    existingItem = it;
                }
            }
            if (existingItem != null)
            {
                if (existingItem.Count > 1)
                {
                    existingItem.Count--;
                }
                else
                {
                    _items.Remove(whichItem);
                    if (_selectedItem >= _items.Count)
                    {
                        _selectedItem = 0;
                    }
                }
            }
        }
Beispiel #2
0
        public void LoadGame(IGameState aGameState)
        {
            int inventoryCount = aGameState.GetIntKey("inv_cnt");

            for (int i = 0; i < inventoryCount; i++)
            {
                string itemName  = aGameState.GetStringKey("itm_" + i);
                int    itemCount = aGameState.GetIntKey("itmc_" + i);
                if (itemName != null && itemName != "")
                {
                    ItemDataAddon it = FPPGame.FPPGameModuleManager.Instance.FindItem(itemName);
                    Add(it);
                }
            }
        }
Beispiel #3
0
        //Dodaje przedmiot do plecaka na pierwsze wolne miejsce
        //Stackuje przedmioty jeśli już istnieja
        public void Add(ItemDataAddon addedItem)
        {
            ItemDataAddon existingItem = null;

            foreach (ItemDataAddon it in _items)
            {
                if (it.Type == addedItem.Type)
                {
                    existingItem = it;
                }
            }
            if (existingItem != null)
            {
                existingItem.Count++;
            }
            else
            {
                _items.Add(addedItem);
            }
        }