示例#1
0
        public override ItemSurrogate GenerateItem(ItemData data)
        {
            ItemSurrogate newItem = new ItemSurrogate();

            newItem.data     = data;
            newItem.template = this;

            if (prefix != null)
            {
                EnchantmentTemplate template = prefix.GetEnchantment();

                if (template != null)
                {
                    newItem.Prefix = new Enchantment(template);
                }
            }

            if (suffix != null)
            {
                EnchantmentTemplate template = suffix.GetEnchantment();

                if (template != null)
                {
                    newItem.Suffix = new Enchantment(template);
                }
            }


            SetupGraph(newItem);

            ItemInputNode node = GetNode <ItemInputNode> ();

            newItem.owner.onChanged += () =>
            {
                if (node == null)
                {
                    return;
                }

                node.Owner[newItem].Value = newItem.owner.Value;
            };

            node.StackSize[newItem].Value    = newItem.Quantity;
            newItem.data.quantity.onChanged += () =>
            {
                node.StackSize[newItem].Value = newItem.Quantity;
            };

            return(newItem);
        }
示例#2
0
        public override ItemSurrogate GenerateItem(ItemData data)
        {
            ItemSurrogate newItem = new ItemSurrogate
            {
                data     = data,
                template = this
            };

            SetupGraph(newItem);

            IInputNode <ItemSurrogate>[] itemNodes = GetNodes <IInputNode <ItemSurrogate> > ();
            foreach (var itemNode in itemNodes)
            {
                itemNode.SetTarget(newItem, newItem);
            }

            if (prefix != null)
            {
                EnchantmentTemplate template = prefix.GetEnchantment();

                if (template != null)
                {
                    newItem.Prefix = new Enchantment(template);
                }
            }

            if (suffix != null)
            {
                EnchantmentTemplate template = suffix.GetEnchantment();

                if (template != null)
                {
                    newItem.Suffix = new Enchantment(template);
                }
            }

            return(newItem);
        }
示例#3
0
 public Enchantment(EnchantmentTemplate _template)
 {
     template = _template;
 }
示例#4
0
 public EnchantmantData(EnchantmentTemplate id, short overrideSeed)
 {
     //EnchantmentID = EnchantmentDatabase.Instance.Enchantments.GetKey (ID);
     seed.Value = overrideSeed;
 }
示例#5
0
 public EnchantmantData(EnchantmentTemplate id)
 {
     //EnchantmentID = EnchantmentDatabase.Instance.Enchantments.GetKey (ID);
     seed.Value = RandomSeed();
 }