Beispiel #1
0
        /// <summary>
        /// Get the first half of the stack.
        /// </summary>
        /// <returns></returns>
        public ResourceStack getHalf()
        {
            ResourceStack newList = new ResourceStack(16);

            for (int i = 0; i < items.Count / 2; i++)
            {
                newList.addItem(items[0]);
                items.RemoveAt(0);
            }

            return(newList);
        }
Beispiel #2
0
        /// <summary>
        /// Adds a pile of items into the stack.
        /// Will return FALSE if the stack is full.
        /// </summary>
        /// <param name="Resource Stack"></param>
        /// <returns></returns>
        public Boolean addStack(ResourceStack rs)
        {
            if (items.Count + rs.items.Count >= maximumSize)
            {
                return(false);
            }

            foreach (Resource r in rs.items)
            {
                items.Add(r);
            }
            return(true);
        }