Пример #1
0
        public AbstractGenerator Append(AbstractGenerator nextNode)
        {
            if (nextNode == this)
            {
                return(this);
            }

            next          = nextNode;
            nextNode.prev = this;
            return(next);
        }
Пример #2
0
        public List <AbstractGenerator> CalculateGeneratorSequence()
        {
            List <AbstractGenerator> nextNodes = new List <AbstractGenerator>();
            AbstractGenerator        node      = this;

            int counter = 0;

            while (node != null)
            {
                counter++;
                if (counter > 1000)
                {
                    Debug.Log(GetType() + "too much interation during searching next elements. break");
                    break;
                }
                nextNodes.Add(node);
                node = node.next;
            }

            List <AbstractGenerator> prevNodes = new List <AbstractGenerator>();

            node    = prev;
            counter = 0;
            while (node != null)
            {
                counter++;
                if (counter > 1000)
                {
                    Debug.Log(GetType() + "too much interation during searching previous elements. break");
                    break;
                }
                prevNodes.Add(node);
                node = node.prev;
            }

            List <AbstractGenerator> result = new List <AbstractGenerator>();

            for (int i = prevNodes.Count - 1; i >= 0; i--)
            {
                result.Add(prevNodes[i]);
            }

            result.AddRange(nextNodes);

            ResetReferencesIfDeserializationFailedWithIt(result);
            return(result);
        }
Пример #3
0
        public AbstractGenerator Clone()
        {
            var sequence           = CalculateGeneratorSequence();
            AbstractGenerator prev = null;

            for (var i = 0; i < sequence.Count; i++)
            {
                var clone = sequence[i].MemberwiseClone();
                if (prev != null)
                {
                    clone.prev = prev;
                    prev.next  = clone;
                }
                prev = clone;
            }
            return(prev);
        }
Пример #4
0
 public static AbstractGenerator Path(this AbstractGenerator abstractGenerator, GameObject go)
 {
     return(abstractGenerator.Append(new ParameterPathToGameObject(go)));
 }
Пример #5
0
 public static AbstractGenerator Enum(this AbstractGenerator abstractGenerator, Enum value)
 {
     return(abstractGenerator.Append(new ParameterEnum(value)));
 }
Пример #6
0
 public static AbstractGenerator Bool(this AbstractGenerator abstractGenerator, bool value)
 {
     return(abstractGenerator.Append(new ParameterBool(value)));
 }
Пример #7
0
 public static AbstractGenerator Double(this AbstractGenerator abstractGenerator, double value)
 {
     return(abstractGenerator.Append(new ParameterDouble(value)));
 }
Пример #8
0
 public static AbstractGenerator Float(this AbstractGenerator abstractGenerator, float value)
 {
     return(abstractGenerator.Append(new ParameterFloat(value)));
 }
Пример #9
0
 public static AbstractGenerator String(this AbstractGenerator abstractGenerator, string value, bool regex = false)
 {
     return(abstractGenerator.Append(new ParameterString(value, regex)));
 }
Пример #10
0
 public static AbstractGenerator Int(this AbstractGenerator abstractGenerator, int value)
 {
     return(abstractGenerator.Append(new ParameterInt(value)));
 }