Esempio n. 1
0
 public DescriptionContainer(string name, string description, ItemEnum requiredItem, int cost)
 {
     Name         = name;
     Description  = description;
     RequiredItem = requiredItem;
     Cost         = cost;
 }
    int GetTrailIndex(ItemEnum item)
    {
        int index = 999;

        switch (item)
        {
        case ItemEnum.trail_white:
            index = 0;
            break;

        case ItemEnum.trail_cyan:
            index = 1;
            break;

        case ItemEnum.trail_red:
            index = 2;
            break;

        case ItemEnum.trail_yellow:
            index = 3;
            break;

        case ItemEnum.trail_black:
            index = 4;
            break;

        case ItemEnum.trail_rainbow:
            index = 5;
            break;
        }
        return(index);
    }
Esempio n. 3
0
        /* start ItemFactory */
        public static Item getItem(ItemEnum item)
        {
            /* start getItem */

            Item items = null;

            if (item == ItemEnum.HEALTHPOTION)
                items = new Ability("Heals a character's health by 25%", "Health Potion", Ability.MAGIC, Ability.SINGLETARGET, Ability.HEALING, 25, 0, ItemType.ABILITY);

            if (item == ItemEnum.MANAPOTION)
            {/* start if */

                items = new Ability("Restores a character's mana by 25%", "Mana Potion", Ability.MAGIC, Ability.HEALING, false, 25, 0, ItemType.ABILITY);
                items.IsMana = true;

            }/* end if */

            if (item == ItemEnum.GANDALFSSTAFF)
                items = new Weapon("Gandalf's Staff", "YOU SHALL NOT PASS!", 100, new int[Character.MAXSTATS] { 5, 100, 5, 20 }, ItemType.WEAPON);

            if (item == ItemEnum.UBERSWORD)
                items = new Weapon("Uber Sword", "Used to PWN noobs.", 100, new int[Character.MAXSTATS] { 100, 15, 30, 30 }, ItemType.WEAPON);

            if (item == ItemEnum.BOMB)
                items = new Ability("Blow up the enemy.", "Bomb", Ability.PHYSICAL, Ability.PARTYTARGET, Ability.DAMAGING, 25, 0, ItemType.ABILITY);

            return items;
        }
Esempio n. 4
0
 public UseItemService(IUser user, ILogger logger, ItemEnum itemEnum, string source)
     : base(user, logger)
 {
     this.apiActionPath = "item/useitem.php";
     this.itemEnum = itemEnum;
     this.source = source;
 }
Esempio n. 5
0
        public Item Create(ItemEnum I)
        {
            Item item = new Coffee(User, Speed);

            switch (I)
            {
            case ItemEnum.Coffee:
                item = new Coffee(User, Speed);
                break;

            case ItemEnum.EnergyDrink:
                item = new EnergyDrink(User, Speed);
                break;

            case ItemEnum.Magnet:
                item = new Magnet(User, Speed);
                break;

            case ItemEnum.Shield:
                item = new Shield(User, Speed);
                break;

            case ItemEnum.NyanCat:
                item = new NyanCat(User, Speed);
                break;

            default:
                break;
            }

            return(item);
        }
Esempio n. 6
0
 public ItemObject(SerializationInfo info, StreamingContext ctxt)
     : base(info, ctxt)
 {
     this.itemEnum = (ItemEnum)info.GetValue("itemEnum", typeof(int));
     this.onStack = (int)info.GetValue("onStack", typeof(int));
     this.positionInInventory = (int)info.GetValue("positionInInventory", typeof(int));
     this.itemIconGraphicPath = (String)info.GetValue("itemIconGraphicPath", typeof(String));
 }
Esempio n. 7
0
 public bool DropItem(ItemEnum itemName)
 {
     if (ItemInCollection(itemName))
     {
         return(itemList.Remove(itemName));
     }
     return(false);
 }
 public Item(string _name, ItemEnum _ienum, ItemStats _istats, GameObject _objref = null, RawImage _rawimage = null)
 {
     this.name     = _name;
     this.objref   = _objref;
     this.rawimage = _rawimage;
     this.ienum    = _ienum;
     this.istats   = _istats;
 }
Esempio n. 9
0
 public Item(ItemEnum itemType, string name, int cost, int damage, int armor)
 {
     ItemType = itemType;
     Name     = name;
     Cost     = cost;
     Damage   = damage;
     Armor    = armor;
 }
Esempio n. 10
0
    public void OnEndDrag(PointerEventData eventData)
    {
        transform.localPosition = startingPoint;
        int      itemIndex = (int)char.GetNumericValue(gameObject.name[0]); //Objektin nimestä indeksi...
        ItemEnum itemName  = Inventory.instance.inventory[itemIndex].name;

        PlayerController.instance.OnMouseLeftClick(itemName);
    }
Esempio n. 11
0
 public ItemObject(SerializationInfo info, StreamingContext ctxt)
     : base(info, ctxt)
 {
     this.itemEnum            = (ItemEnum)info.GetValue("itemEnum", typeof(int));
     this.onStack             = (int)info.GetValue("onStack", typeof(int));
     this.positionInInventory = (int)info.GetValue("positionInInventory", typeof(int));
     this.itemIconGraphicPath = (String)info.GetValue("itemIconGraphicPath", typeof(String));
 }
Esempio n. 12
0
        public static bool ItemIsMoreThan2000Gold(this ItemEnum item)
        {
            HashSet <int> expensiveItems = new HashSet <int>()
            {
                1400, 1401, 1402, 1412, 1413, 1414, 1416, 1419, 2065, 3001, 3003, 3004, 3007, 3008, 3022, 3025, 3026, 3027, 3029, 3030, 3031, 3033, 3036, 3040, 3042, 3043, 3046, 3048, 3050, 3053, 3065, 3068, 3071, 3072, 3074, 3075, 3078, 3083, 3084, 3085, 3087, 3089, 3091, 3094, 3095, 3100, 3102, 3107, 3109, 3110, 3115, 3116, 3124, 3135, 3137, 3139, 3142, 3143, 3146, 3147, 3151, 3152, 3153, 3156, 3157, 3161, 3165, 3174, 3179, 3181, 3190, 3193, 3194, 3197, 3198, 3222, 3285, 3371, 3373, 3374, 3379, 3380, 3382, 3383, 3384, 3386, 3387, 3388, 3389, 3390, 3504, 3508, 3742, 3748, 3800, 3812, 3814, 3905, 3907
            };

            return(expensiveItems.Contains((int)item));
        }
Esempio n. 13
0
        public static ItemBase CreateItem(ItemEnum _enum, int _maxSlot, int _num)
        {
            ItemNormal _item = new ItemNormal();

            _item.m_itemEnum = _enum;
            _item.m_num      = _num;
            _item.m_maxSlot  = _maxSlot;
            return(_item);
        }
Esempio n. 14
0
        public Item(ItemType type, ItemEnum item, String name, String description)
        {
            /* start constructor */

            mType = type;
            mItem = item;
            mName = name;
            mDescription = description;
        }
Esempio n. 15
0
 public bool CollectItem(ItemEnum itemName)
 {
     if (!ItemInCollection(itemName))
     {
         itemList.Add(itemName);
         return(true);
     }
     return(false);
 }
Esempio n. 16
0
    IEnumerator ShowTheItemTips(ItemEnum item, int count)
    {
        // itemOnGroundIcon.sprite = ItemFactory.GetItem(item).GetIcon();
        // itemOnGroundName.text = ItemFactory.GetItem((int)item).GetName();
        itemOnGroundCount.text = count.ToString();
        itemTips.SetActive(true);
        yield return(new WaitForSeconds(3.0f));

        itemTips.SetActive(false);
    }
Esempio n. 17
0
    public static int Compare(ItemStack obj, ItemStack other)
    {
        int datacmp = ItemEnum.Compare(obj.GetItem().itemData, other.GetItem().itemData);

        if (datacmp != 0)
        {
            return(datacmp);
        }
        return(obj.amount.CompareTo(other.amount));
    }
Esempio n. 18
0
 public static ItemData GetItemData(ItemEnum item)
 {
     if (defs.ContainsKey(item))
     {
         return(defs[item]);
     }
     else
     {
         return(new ItemData());
     }
 }
Esempio n. 19
0
    //找到目前左下角快捷栏显示的物品,然后使用物品
    public void UseItem()
    {
        if (!sm.isGround)
        {
            return;
        }
        ItemEnum itemId = inventory.GetCurrentItem().GetID();

        ac.animator.SetInteger("itemOnUseID", (int)itemId);
        ac.animator.SetTrigger("useItem");
    }
 public Item(ItemEnum id, string name_id, string desc_id, int price, LevelEnum level = LevelEnum.none, bool isEquipable = false,
             ItemTypeEnum type = ItemTypeEnum.none)
 {
     this.id          = id;
     this.name_id     = name_id;
     this.desc_id     = desc_id;
     this.price       = price;
     this.level       = level;
     this.isEquipable = isEquipable;
     this.type        = type;
 }
Esempio n. 21
0
        public Ability(String description, String name, bool type, bool targetSpread, bool affectEnemy, int baseDamage, int cost, ItemType itemType, ItemEnum item)
            : base(itemType, item, name, description)
        {
            /* start constructor */

            mType = type;
            mTargetSpread = targetSpread;
            mAffectEnemy = affectEnemy;
            mBaseDamage = baseDamage;
            mCost = cost;
        }
Esempio n. 22
0
 // If a hat is equiped, display it
 void Start()
 {
     if (ApplicationController.ac.playerData.equipedItems.ContainsKey(ItemTypeEnum.hat))
     {
         hat = ApplicationController.ac.playerData.equipedItems[ItemTypeEnum.hat];
         int index = GetHatIndex(hat);
         if (index < hatPrefabs.Length)
         {
             Instantiate(hatPrefabs[index], this.transform.position, hatPrefabs[index].rotation, this.transform);
         }
     }
 }
Esempio n. 23
0
 // If a trail is equiped, display it
 void Start()
 {
     if (ApplicationController.ac.playerData.equipedItems.ContainsKey(ItemTypeEnum.trail))
     {
         trail = ApplicationController.ac.playerData.equipedItems[ItemTypeEnum.trail];
         int index = GetTrailIndex(trail);
         if (index < trailPrefabs.Length)
         {
             Instantiate(trailPrefabs[index], this.transform.position, trailPrefabs[index].rotation, this.transform);
         }
     }
 }
Esempio n. 24
0
 public GameObject GetItemPrefab(ItemEnum item)
 {
     if (item.Equals(ItemEnum.HealthPotion))
     {
         return(prefabs.Find(i => i.GetComponent <ItemManager>().item.Equals(ItemEnum.HealthPotion)));
     }
     if (item.Equals(ItemEnum.ManaPotion))
     {
         return(prefabs.Find(i => i.GetComponent <ItemManager>().item.Equals(ItemEnum.ManaPotion)));
     }
     return(null);
 }
Esempio n. 25
0
    public void OnMouseLeftClick(ItemEnum itemInHand)
    {
        Vector2    mousePosition       = UF.GetMousePos();
        GameObject somethingUnderMouse = UF.FetchGameObject(UF.GetMousePos(), LayerMask.GetMask("Interractable"));

        if (somethingUnderMouse == null) //Jos hiiren alla ei ole mitään niin liikutaan
        {
            PlayerMovement.instance.Move(mousePosition);
        }
        else
        {
            somethingUnderMouse.GetComponent <Interractable>().GiveActivationCommand(itemInHand);
        }
    }
Esempio n. 26
0
    public static Item CreateItem(ItemEnum item)
    {
        switch (item)
        {
        case ItemEnum.HealthPotion:
            return(new HealthPotion());

        case ItemEnum.ManaPotion:
            return(new ManaPotion());

        case ItemEnum.StaminaPotion:
            return(new StaminaPotion());

        default:
            return(null);
        }
    }
Esempio n. 27
0
    public void SetItem(int item2)
    {
        var item = (ItemEnum)item2;

        itemEnum = item;
        ammo.SetActive(item == ItemEnum.Ammo);
        rocket.SetActive(item == ItemEnum.Rocket);
        nitro.SetActive(item == ItemEnum.Nitro);
        life.SetActive(item == ItemEnum.Life);
        if (item == ItemEnum.None)
        {
            _Game.disabledItems.Add(this);
        }
        else
        {
            _Game.disabledItems.Remove(this);
        }
    }
Esempio n. 28
0
 public virtual void GiveActivationCommand(ItemEnum activationItem)
 {
     if (key != activationItem)
     {
         print("Tarvitsee jotain käytettäväksi.......");
         return;
     }
     if (activationPlaces.Count == 0) //Jos voi aktivoida mistä vain
     {
         Activate();
     }
     else
     {
         Vector2 playerPos = PlayerMovement.instance.transform.position;
         Vector2 goal      = UF.ClosestPoint(playerPos, activationPlaces);
         PlayerMovement.instance.GoActivate(goal, gameObject);
     }
 }
Esempio n. 29
0
    int GetHatIndex(ItemEnum item)
    {
        int index = 999;

        switch (item)
        {
        case ItemEnum.hat_top:
            index = 0;
            break;

        case ItemEnum.hat_cowboy:
            index = 1;
            break;

        case ItemEnum.hat_academic:
            index = 2;
            break;
        }
        return(index);
    }
    public bool BuyItem(ItemEnum itemEnum, Text kittyzText = null, bool doSave = true, bool initMode = false)
    {
        int price = this.items [itemEnum].price;

        if (price <= playerData.kittyz || initMode)
        {
            this.items [itemEnum].isBought = true;
            if (!this.playerData.boughtItems.Contains(itemEnum))
            {
                this.playerData.boughtItems.Add(itemEnum);
            }

            // if the item is a level, unlock the level
            if (this.items [itemEnum].level != LevelEnum.none)
            {
                UnlockLevel(this.items [itemEnum].level, false);
            }

            if (!initMode)
            {
                playerData.updateKittys(-price, kittyzText, false);

                // if the item is a "max_life" item
                if (Item.max_life_items.Contains(itemEnum))
                {
                    this.playerData.max_life++;
                }
            }

            if (doSave)
            {
                Save();
            }

            return(true);
        }
        else
        {
            return(false);
        }
    }
    // Equip an item
    public void EquipItem(ItemEnum itemEnum, bool doSave = true)
    {
        Item item = this.items[itemEnum];

        if (!item.isBought)
        {
            return;
        }
        if (playerData.equipedItems.ContainsKey(item.type))
        {
            playerData.equipedItems[item.type] = itemEnum;
        }
        else
        {
            playerData.equipedItems.Add(item.type, itemEnum);
        }
        if (doSave)
        {
            Save();
        }
    }
Esempio n. 32
0
        public ItemObject createItemObject(ItemEnum _ItemEnum)
        {
            GameLibrary.Model.Object.ItemObject var_ItemObject = new ItemObject();
            var_ItemObject.ItemEnum = _ItemEnum;
            var_ItemObject.Scale = 1;
            var_ItemObject.Velocity = new Vector3(0, 0, 0);

            switch (_ItemEnum)
            {
                case ItemEnum.GoldCoin:
                    {
                        var_ItemObject.Body.MainBody.TexturePath = "Character/GoldCoin";
                        var_ItemObject.ItemIconGraphicPath = "Character/GoldCoin";
                        var_ItemObject.Size = new Microsoft.Xna.Framework.Vector3(16, 16, 0);
                        var_ItemObject.StackMax = 5;
                        var_ItemObject.OnlyFromPlayerTakeAble = true;
                        break;
                    }
            }
            return var_ItemObject;
        }
Esempio n. 33
0
 public IItem MakeItem(ItemEnum spriteType, Vector2 location)
 {
     return(spriteType switch
     {
         ItemEnum.MagicalBoomerang => new BlueBoomerangItem(texture1, location),
         ItemEnum.Boomerang => new BoomerangItem(texture1, location),
         ItemEnum.BlueRing => new BlueRing(texture1, location),
         ItemEnum.RedRing => new Ring(texture1, location),
         ItemEnum.BlueCandle => new BlueCandle(texture1, location),
         ItemEnum.RedCandle => new Candle(texture1, location),
         ItemEnum.Food => new Meat(texture1, location),
         ItemEnum.Letter => new BlueMap(texture1, location),
         ItemEnum.Map => new Map(texture1, location),
         ItemEnum.BluePotion => new BluePotion(texture1, location),
         ItemEnum.RedPotion => new Potion(texture1, location),
         ItemEnum.BlueRupee => new BlueRupee(texture1, location),
         ItemEnum.Rupee => new Rupee(texture1, location),
         ItemEnum.Clock => new Clock(texture1, location),
         ItemEnum.Bow => new Bow(texture1, location),
         ItemEnum.HeartContainer => new HeartContainer(texture1, location),
         ItemEnum.TriforcePiece => new TriforcePiece(texture1, location, game),
         ItemEnum.Compass => new Compass(texture1, location),
         ItemEnum.Key => new Key(texture1, location),
         ItemEnum.Fairy => new Fairy(texture1, location, game),
         ItemEnum.FairyDistract => new FairyDistract(texture1, location, game),
         ItemEnum.Arrow => new ArrowItem(texture1, location),
         ItemEnum.Bomb => new BombItem(texture1, location),
         ItemEnum.PowerBracelet => new PowerBracelet(texture1, location),
         ItemEnum.BookOfMagic => new BookOfMagic(texture1, location),
         ItemEnum.Flute => new Flute(texture1, location),
         ItemEnum.Raft => new Raft(texture1, location),
         ItemEnum.Stepladder => new StepLadder(texture1, location),
         ItemEnum.MagicalKey => new MagicalKey(texture1, location),
         ItemEnum.MagicalRod => new MagicalRod(texture1, location),
         ItemEnum.MagicalSword => new MagicalSword(texture1, location),
         ItemEnum.WhiteSword => new WhiteSword(texture1, location),
         ItemEnum.WoodenSword => new WoodenSword(texture1, location),
         ItemEnum.GanonTriforceAshes => new GanonTriforceAshes(texture2, location, game),
         _ => throw new ArgumentException("Invalid sprite! " + spriteType.ToString() + " Sprite factory failed."),
     });
Esempio n. 34
0
    public void DropoffItem(ItemEnum item)
    {
        successfulItemCount++;
        OnItemDelivered?.Invoke(item);
        StartCoroutine(ImproveWater());
        if (successfulItemCount == 2)
        {
            lilyPadGroup1.Grow();
        }
        if (successfulItemCount == 4)
        {
            lilyPadGroup2.Grow();
        }
        if (item == ItemEnum.Seeds)
        {
            StartCoroutine(GrowTrees());
        }
        if (item == ItemEnum.Wood)
        {
            DockGroup.Grow();
        }
        if (item == ItemEnum.Metal)
        {
            StartCoroutine(GrowBalcony());
        }
        if (item == ItemEnum.Glass)
        {
            WindowGrower.Play();
        }
        if (item == ItemEnum.VineSeeds)
        {
            VineGroup.Play();
        }

        if (successfulItemCount >= itemGoal)
        {
            mainCamera.DoFinale();
        }
    }
        public static bool TryAddItem(ItemEnum item)
        {
            ItemData data  = ItemManager.GetItemData(item);
            var      slots = inventory.Where(t => (t.id == item && t.number < data.stack));

            if (slots.Count() > 0)
            {
                var idx = inventory.IndexOf(slots.First());
                inventory[idx].number += 1;
                return(true);
            }

            if (inventory.Count < size)
            {
                inventory.Add(new InventoryItem()
                {
                    id = item, number = 0, position = Enumerable.Range(0, size).Where(i => !inventory.Select(t => t.position).Contains(i)).Min()
                });
            }

            return(false);
        }
Esempio n. 36
0
        public ItemObject createItemObject(ItemEnum _ItemEnum)
        {
            ItemObject var_ItemObject = new ItemObject();

            var_ItemObject.ItemEnum = _ItemEnum;
            var_ItemObject.Scale    = 1;
            var_ItemObject.Velocity = new Vector3(0, 0, 0);

            switch (_ItemEnum)
            {
            case ItemEnum.GoldCoin:
            {
                var_ItemObject.Body.MainBody.TexturePath = "Character/GoldCoin";
                var_ItemObject.ItemIconGraphicPath       = "Character/GoldCoin";
                var_ItemObject.Size     = new Microsoft.Xna.Framework.Vector3(16, 16, 0);
                var_ItemObject.StackMax = 5;
                var_ItemObject.OnlyFromPlayerTakeAble = true;
                break;
            }
            }
            return(var_ItemObject);
        }
 public void SetItem(int item2)
 {
     var item = (ItemEnum)item2;
     itemEnum = item;
     ammo.SetActive(item == ItemEnum.Ammo);
     rocket.SetActive(item == ItemEnum.Rocket);
     nitro.SetActive(item == ItemEnum.Nitro);
     life.SetActive(item == ItemEnum.Life);
     if (item == ItemEnum.None)
     {
         _Game.disabledItems.Add(this);
     }
     else
     {
         _Game.disabledItems.Remove(this);
     }
 }