Exemplo n.º 1
0
        /// <summary>
        /// <para>Fill backpack (GameItem list) with random tools and return it.</para>
        /// <para>Used by initializing a field [backpack] by Heroes.</para>
        /// </summary>
        /// <param name="backpack">Backpack to fill</param>
        public static GenericList <GameItem> fillUpBackPack()
        {
            if (!PasswordManager.isLoggedAdmin())
            {
                return(new GenericList <GameItem>());
            }

            ItemsShop itemsShopInst         = ItemsShop.Instance;
            GenericList <GameItem> backpack = new GenericList <GameItem>();

            for (int i = 0; i < itemsShopInst.Items.getSize(); i++)
            {
                backpack.Add(itemsShopInst.Items.Get(i), i);
            }

            return(backpack);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create and fill an instance of a backpack.
        /// </summary>
        /// <returns></returns>
        private static GenericList <GameItem> defineBackPack()
        {
            if (!PasswordManager.isLoggedAdmin())
            {
                return(new GenericList <GameItem>());
            }

            GenericList <GameItem> backpack = new GenericList <GameItem>();

            backpack.addFirst(new Sword("magic_sword_1", 100, 50));
            backpack.addFirst(new Sword("magic_sword_2", 200, 60));
            backpack.addFirst(new Sword("magic_sword_3", 300, 70));
            backpack.addFirst(new Shield("mega_shield_1", 50, 100));
            backpack.addFirst(new Shield("mega_shield_2", 60, 200));
            backpack.addFirst(new Shield("mega_shield_3", 70, 300));

            return(backpack);
        }