Esempio n. 1
0
        /// <summary>
        /// Crea una extension a partir de un item base
        /// </summary>
        /// <param name="baseItem">Item base</param>
        public static VirtualItemDecorator MakeItem(VirtualItem baseItem)
        {
            VirtualItemDecorator item;

            if (baseItem is EquippableVG)
            {
                item = new EquippableVGDecorator(baseItem as EquippableVG);
            }
            else if (baseItem is LifetimeVG)
            {
                item = new LifetimeVGDecorator(baseItem as LifetimeVG);
            }
            else if (baseItem is VirtualGood)
            {
                item = new VirtualGoodDecorator(baseItem as VirtualGood);
            }
            else if (baseItem is PurchasableVirtualItem)
            {
                item = new PurchasableVirtualItemDecorator(baseItem as PurchasableVirtualItem);
            }
            else
            {
                item = new VirtualItemDecorator(baseItem as VirtualItem);
            }

            return item;
        }
Esempio n. 2
0
        private static void DrawInteractions(VirtualItemDecorator item, float width, float height)
        {
            Rect buttonLocation = new Rect(0, height - width * 0.175f, width * 0.2f, width * 0.175f);

            if (item.IsPurchasable())
            {
                if (GUI.Button(buttonLocation, (item as PurchasableVirtualItemDecorator).Price + string.Empty))
                    item.Buy();
            }

            buttonLocation.x += buttonLocation.width + 10;
            if (item.IsEquippable() && GUI.Button(buttonLocation, "Equip"))
            {
                item.Equip();
            }

            buttonLocation.x += buttonLocation.width + 10;
            if (item.IsUpgradable() && GUI.Button(buttonLocation, "Upgr"))
            {
                item.Upgrade();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Dibuja en pantalla la informacion de un item
        /// </summary>
        /// <param name="item">Item a dibujar</param>
        /// <param name="width">Ancho a ocupar</param>
        /// <param name="height">Alto a ocupar</param>
        private static void DrawItem(VirtualItemDecorator item, float width, float height)
        {
            Rect rect = new Rect(0, 0, width, height);
            GUI.Label(rect, "Name: " + item.Name);

            rect.y += 25;
            GUI.Label(rect, "Desc: " + item.Description);

            rect.y += 25;
            GUI.Label(rect, "Balance: " + item.Balance);

            if (item.IsEquippable())
            {
                rect.y += 25;
                GUI.Label(rect, "Equipped: " + (item as EquippableVGDecorator).Equipped);
            }

            if (item.IsUpgradable())
            {
                rect.y += 25;
                GUI.Label(rect, "Lvl: " + (item as VirtualGoodDecorator).UpgradeLevel);
            }
        }