Exemple #1
0
        public override TaskResult Run(ITaskNode node)
        {
            var go        = node.Context.GetGameObject();
            var groups    = go.GetComponent <GameObjectGroup>();
            var inventory = SharedInventory ? compIndex.GetSingle <IInventory>() : go.GetComponent <IInventory>();
            var items     = groups.GetInGroup(Group);

            for (int i = 0; i < items.Count; i++)
            {
                var collectible = items[i].GetComponentInEntity <CollectibleItem>();
                inventory.Add(collectible.catalogItem, collectible.quantity);

                goMgr.Destroy(collectible.gameObject);
            }

            items.ReturnToPool();

            return(TaskResult.Success);
        }
Exemple #2
0
 /// <summary>
 /// Gets the behaviour indexed by the specified type.
 /// </summary>
 public static T GetSingle <T>() where T : class
 {
     return(index.GetSingle <T>());
 }