Пример #1
0
        public void testme()
        {
            var    combini     = ItemCombination.Empty();
            var    item1       = new Item(1, 2);
            Length totalLength = 3;
            var    itemMethods = new ItemUtilsProvider();


            var rest = KnappsackCombiner.CompleteCombination(combini, item1.ToSequence(2), itemMethods, totalLength);

            Assert.IsFalse(false);
        }
Пример #2
0
    private bool CanCombineSelected(Item item, ItemCombination combo)
    {
        //if (!combo.CanCombine(item, selectedItem)) return false;

        Vector2Int?invPosition = Inventory.current.GetPosition(item);

        if (invPosition.HasValue)
        {
            return(Inventory.current.CanFit(combo.result, invPosition.Value, item));
        }

        return(true);
    }
Пример #3
0
    bool PickupItem(Item item, Hands hand)
    {
        if (item == null)
        {
            return(false);
        }
        if ((item.transform.position - transform.position).magnitude > Range)
        {
            return(false);
        }
        switch (hand)
        {
        case Hands.LEFT:
            if (Hand1 != null)
            {
                return(false);
            }
            Hand1 = item;
            break;

        case Hands.RIGHT:
            if (Hand2 != null)
            {
                return(false);
            }
            Hand2 = item;
            break;
        }
        item.gameObject.SetActive(false);
        item.transform.parent        = transform;
        item.transform.localPosition = new Vector3(0, 0, item.transform.localPosition.z);
        if (Hand1 != null && Hand2 != null)
        {
            for (int i = 0; i < ItemCombinations.Length; ++i)
            {
                ItemCombination combination = ItemCombinations[i];
                if (combination.InputA == null || combination.InputB == null || combination.Output == null)
                {
                    continue;
                }
                if ((combination.InputA.name == Hand1.name && combination.InputB.name == Hand2.name) || (combination.InputA.name == Hand2.name && combination.InputB.name == Hand1.name))
                {
                    activeCombination = i;
                    break;
                }
            }
        }
        PickupEvent.Invoke(hand);
        return(true);
    }
Пример #4
0
        public void setProp(string aProperty, object aValue)
        {
            int featureIndex = aProperty.IndexOf('.');

            if ((featureIndex != -1))
            {
                string featurePath     = aProperty.Substring(0, featureIndex);
                string featureProperty = aProperty.Substring((featureIndex + 1));
                if ((featurePath == "ItemCombination"))
                {
                    ItemCombination.setProp(featureProperty, aValue);
                }
                if ((featurePath == "VariableBinding"))
                {
                    VariableBinding.setProp(featureProperty, aValue);
                }
            }
        }
Пример #5
0
        public Articy.Unity.Interfaces.ScriptDataProxy getProp(string aProperty)
        {
            int featureIndex = aProperty.IndexOf('.');

            if ((featureIndex != -1))
            {
                string featurePath     = aProperty.Substring(0, featureIndex);
                string featureProperty = aProperty.Substring((featureIndex + 1));
                if ((featurePath == "ItemCombination"))
                {
                    return(ItemCombination.getProp(featureProperty));
                }
                if ((featurePath == "VariableBinding"))
                {
                    return(VariableBinding.getProp(featureProperty));
                }
            }
            return(null);
        }
Пример #6
0
 private void CloneProperties(object aClone)
 {
     Articy.ManiacManfred.Templates.ItemTemplate newClone = ((Articy.ManiacManfred.Templates.ItemTemplate)(aClone));
     if ((ItemCombination != null))
     {
         newClone.ItemCombination = ((Articy.ManiacManfred.Features.ItemCombinationFeature)(ItemCombination.CloneObject()));
     }
     if ((VariableBinding != null))
     {
         newClone.VariableBinding = ((Articy.ManiacManfred.Features.VariableBindingFeature)(VariableBinding.CloneObject()));
     }
 }