Ejemplo n.º 1
0
        public void RemoveInteractiveCollectibles(string id)
        {
            m_collectibleCallbacks.RemoveAll(id);

            if (InteractiveItemTable && !ShowAllItems)
            {
                var items = m_interactiveCollectibles[id];

                if (items != null)
                {
                    foreach (var i in items)
                    {
                        if (i == m_currentItem)
                        {
                            m_currentItem = null;
                        }

                        InteractiveItemTable.RemoveItem(i);
                        m_currentCollectibles.Remove(i.Collectible.Id);
                    }
                }
            }

            SetHasItems();
        }
Ejemplo n.º 2
0
        void SyncInventory()
        {
            if (ShowAllItems)
            {
                InteractiveItemTable.Clear();

                foreach (var item in Inventory.Instance.AllItems)
                {
                    ARInteractiveCollectibleItem _tblItem = null;

                    _tblItem = AddCollectibleItem(item.Collectible, () =>
                    {
                        var callbacks = m_collectibleCallbacks
                                        .Where(kkv => kkv.Value.ContainsKey(item.Collectible.Id))
                                        .Select(kkv => kkv.Value[item.Collectible.Id]);

                        if (callbacks != null && callbacks.Count() > 0)
                        {
                            _tblItem.Success();

                            foreach (var c in callbacks.ToArray())
                            {
                                c();
                            }

                            if (OnSuccess != null)
                            {
                                OnSuccess.Invoke();
                            }
                        }
                        else
                        {
                            _tblItem.Fail();

                            if (OnFail != null)
                            {
                                OnFail.Invoke();
                            }
                        }
                    });
                }
            }

            SetHasItems();
        }
Ejemplo n.º 3
0
        public void AddInteractiveCollectible(string id, Collectible collectible, Action onSelect)
        {
            m_collectibleCallbacks.Add(id, collectible.Id, onSelect);

            // Each collectible should only appear once
            if (m_currentCollectibles.Contains(collectible.Id))
            {
                return;
            }

            if (InteractiveItemTable && InteractiveItem)
            {
                var item = AddCollectibleItem(collectible, onSelect);

                m_currentItem = item;

                m_interactiveCollectibles.Add(id, item);
            }

            SetHasItems();
        }