Пример #1
0
 public bool ElementToolUse(ElementIns element = null)
 {
     ElementIns.ElementType targetType = element != null ? element.Type : ElementIns.ElementType.Hole;
     for (int i = 0; i < EquiSlots.Length; i++)
     {
         var toolEquipment = EquiSlots[i].GetComponentInChildren <ItemEquipment>();
         if (toolEquipment == null)
         {
             continue;
         }
         var toolIns = toolEquipment.ItemIns;
         if (toolIns == null)
         {
             continue;
         }
         if (toolIns.Item.Type == ItemContainer.ItemType.Tool
             &&
             (EquiSlots[i].EquType == ItemContainer.PlaceType.Right && toolIns.UserItem.Order == (int)ItemContainer.PlaceType.Right ||
              EquiSlots[i].EquType == ItemContainer.PlaceType.Left && toolIns.UserItem.Order == (int)ItemContainer.PlaceType.Left)
             &&
             toolIns.UserItem.TimeToUse > 0
             &&
             targetType == toolIns.Item.FavoriteElement
             )
         {
             toolEquipment.UseItem(1);
             UpdateInventory();
             return(true);
         }
     }
     PrintMessage("You don't have a right tool to use", Color.yellow);
     return(false);
 }
Пример #2
0
    protected ItemContainer(
        int id, string name, string desc,
        string iconPath, int iconId, int cost,
        int weight, int maxStackCnt, bool unique, int expirationDays,
        ItemType type, DataTypes.Rarity rarity)
    {
        Id             = id;
        Name           = name;
        Description    = desc;
        IconPath       = iconPath;
        IconId         = iconId;
        Cost           = cost;
        Weight         = weight;
        Type           = type;
        MaxStackCnt    = maxStackCnt;
        Unique         = unique;
        ExpirationDays = expirationDays;
        Rarity         = rarity;
        IsEnable       = true;
        switch (Type)
        {
        case ItemType.Consumable:
            Health = Mana = Energy = Coin = Gem = Recipe = Egg = 0;
            break;

        case ItemType.Equipment:
            PlaceHolder = PlaceType.None;
            Carry       = CarryCnt = Speed =
                Agility = Bravery = Charming = Intellect = Crafting = Researching = Stamina = Strength = 0;
            break;

        case ItemType.Weapon:
            CarryType                = Hands.OneHand;
            SpeedAttack              = SpeedDefense =
                AbilityAttack        = AbilityDefense =
                    MagicAttack      = MagicDefense =
                        PoisonAttack = PoisonDefense = 0;
            break;

        case ItemType.Tool:
            CarryType       = Hands.OneHand;
            MaxTimeToUse    = 0;
            FavoriteElement = ElementIns.ElementType.Hole;
            break;
        }
    }
Пример #3
0
    private Sprite GetToolSprite(ElementIns.ElementType type)
    {
        switch (type)
        {
        case ElementIns.ElementType.Hole:
            return(_toolSpriteList[16]);

        case ElementIns.ElementType.Building:
            return(_toolSpriteList[10]);

        case ElementIns.ElementType.Bush:
            return(_toolSpriteList[8]);

        case ElementIns.ElementType.Rock:
            return(_toolSpriteList[0]);

        case ElementIns.ElementType.Tree:
            print("Tree");
            return(_toolSpriteList[2]);

        default:
            return(null);
        }
    }