Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AssemblyCSharp.Scripts.EntLogic.SerializationObjects.Assignment"/> class.
        /// </summary>
        public Assignment()
        {
            VariableSignature signature = RegistrationManager.SelectReadWriteVariableAtRandom();

            this.readWriteVariable = new ReadWriteVariable(signature);
            this.rightStatement    = new RightStatement(signature.VariableType);
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AssemblyCSharp.Scripts.EntLogic.SerializationObjects.Assignment"/> class.
        /// </summary>
        /// <param name="reader">Reader.</param>
        public Assignment(FileIOManager reader)
        {
            string nextLine = reader.ReadNextContentLineAndTrim();

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

            nextLine = reader.ReadNextContentLineAndTrim();
            if (CommonHelperMethods.StringStartsWith(nextLine, RightStatement.Name))
            {
                this.rightStatement = new RightStatement(reader);
            }
            else
            {
                CommonHelperMethods.ThrowStatementParseException(
                    nextLine,
                    reader,
                    RightStatement.Name);
            }
        }
Exemple #3
0
        /// <summary>
        /// Will possibly mutate this section of logic.
        /// </summary>
        public void PossiblyMutate()
        {
            if (GeneticLogicRoot.RollMutateDice())
            {
                VariableSignature signature = RegistrationManager.SelectReadWriteVariableAtRandom();
                this.readWriteVariable = new ReadWriteVariable(signature);
                this.rightStatement    = new RightStatement(signature.VariableType);
                return;
            }

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