Esempio n. 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();
            }
        }
Esempio n. 2
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();
            }
        }
Esempio n. 3
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
                });
            }
        }