Пример #1
0
        /// <summary>
        /// Get a list of all pickups that are on the ground
        /// </summary>
        /// <returns></returns>
        private static IEnumerable <PickupObject> GetPickups()
        {
            List <PickupObject> output = new List <PickupObject>();

            //itterate through all loaded pickups
            foreach (var pickup in TypeTracker.GetTrackedObjects <PickupObject>())
            {
                //this check is used to help keep TypeTracker clean
                //this helps prevent leaks
                //Ideally this code would be in TypeTracker instead, but for some reason, the null check works unexpectidly on generics
                if (pickup == null)
                {
                    TypeTracker.Remove <PickupObject>(pickup);
                }
                else
                {
                    //determine if this pickup is a debris object
                    bool debris = pickup.GetComponentInParent <DebrisObject>() != null || pickup.GetComponentInChildren <DebrisObject>() != null;
                    if (debris)
                    {
                        output.Add(pickup);
                    }
                }
            }

            return(output);
        }
Пример #2
0
        /// <summary>
        /// Gets a list of all items currently on a pedestal
        /// </summary>
        /// <returns></returns>
        private static IEnumerable <RewardPedestal> GetPedestalItems()
        {
            List <RewardPedestal> output = new List <RewardPedestal>();

            //itterate through all pedestal items
            foreach (var ped in TypeTracker.GetTrackedObjects <RewardPedestal>())
            {
                //this check is used to help keep TypeTracker clean
                //this helps prevent leaks
                //Ideally this code would be in TypeTracker instead, but for some reason, the null check works unexpectidly on generics
                if (ped == null)
                {
                    TypeTracker.Remove <RewardPedestal>(ped);
                }
                else
                {
                    output.Add(ped);
                }
            }
            return(output);
        }
Пример #3
0
        /// <summary>
        /// Get a list of all items in the shop
        /// </summary>
        /// <returns></returns>
        private static IEnumerable <ShopItemController> GetShopItems()
        {
            List <ShopItemController> output = new List <ShopItemController>();

            //itterate through all loaded shop items
            foreach (var shopItem in TypeTracker.GetTrackedObjects <ShopItemController>())
            {
                //this check is used to help keep TypeTracker clean
                //this helps prevent leaks
                //Ideally this code would be in TypeTracker instead, but for some reason, the null check works unexpectidly on generics
                if (shopItem == null)
                {
                    TypeTracker.Remove <ShopItemController>(shopItem);
                }
                else
                {
                    output.Add(shopItem);
                }
            }

            return(output);
        }