Example #1
0
        public void PossiblyMutate()
        {
            if (GeneticLogicRoot.RollMutateDice())
            {
                this.conditionalLeftStatement = new ConditionalLeftStatement();
                this.leftStatement            = null;
                return;
            }

            if (GeneticLogicRoot.RollMutateDice())
            {
                this.conditionalLeftStatement = null;
                this.leftStatement            = new LeftStatement();
                return;
            }

            if (this.conditionalLeftStatement != null)
            {
                this.conditionalLeftStatement.PossiblyMutate();
            }

            if (this.leftStatement != null)
            {
                this.leftStatement.PossiblyMutate();
            }
        }
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="AssemblyCSharp.Scripts.EntLogic.SerializationObjects.ConditionalLeftStatement"/> class.
        /// </summary>
        /// <param name="reader">Reader.</param>
        public ConditionalLeftStatement(FileIOManager reader)
        {
            // Condition block parse
            string nextLine = reader.ReadNextContentLineAndTrim();

            if (CommonHelperMethods.StringStartsWith(nextLine, Condition.Name))
            {
                this.condition = new Condition(reader);
            }
            else
            {
                CommonHelperMethods.ThrowStatementParseException(
                    nextLine,
                    reader,
                    Condition.Name);
            }

            // LeftStatement block parse
            nextLine = reader.ReadNextContentLineAndTrim();
            if (CommonHelperMethods.StringStartsWith(nextLine, LeftStatement.Name))
            {
                this.leftStatement = new LeftStatement(reader);
            }
            else
            {
                CommonHelperMethods.ThrowStatementParseException(
                    nextLine,
                    reader,
                    LeftStatement.Name);
            }
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AssemblyCSharp.Scripts.EntLogic.SerializationObjects.RootStatement"/> class.
        /// </summary>
        public RootStatement()
        {
            int value = CommonHelperMethods.GetRandomPositiveInt0ToValue(1);

            if (value == 0)
            {
                this.conditionalLeftStatement = new ConditionalLeftStatement();
            }
            else
            {
                this.leftStatement = new LeftStatement();
            }
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AssemblyCSharp.Scripts.EntLogic.SerializationObjects.RootStatement"/> class.
        /// </summary>
        /// <param name="reader">A StreamReader pointed to line where this RootStatement begins.</param>
        public RootStatement(FileIOManager reader)
        {
            string nextLine = reader.ReadNextContentLineAndTrim();

            if (CommonHelperMethods.StringStartsWith(nextLine, ConditionalLeftStatement.Name))
            {
                this.conditionalLeftStatement = new ConditionalLeftStatement(reader);
            }
            else if (CommonHelperMethods.StringStartsWith(nextLine, LeftStatement.Name))
            {
                this.leftStatement = new LeftStatement(reader);
            }
            else
            {
                CommonHelperMethods.ThrowStatementParseException(
                    nextLine,
                    reader,
                    new List <string>()
                {
                    ConditionalLeftStatement.Name, LeftStatement.Name
                });
            }
        }
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="AssemblyCSharp.Scripts.EntLogic.SerializationObjects.ConditionalLeftStatement"/> class.
 /// </summary>
 public ConditionalLeftStatement()
 {
     this.condition     = new Condition();
     this.leftStatement = new LeftStatement();
 }