public void PossiblyMutate() { if (GeneticLogicRoot.RollMutateDice()) { this.conditionalLeftStatement = new ConditionalLeftStatement(1); this.leftStatement = null; return; } if (GeneticLogicRoot.RollMutateDice()) { this.conditionalLeftStatement = null; this.leftStatement = new LeftStatement(1); 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.RootStatement"/> class. /// </summary> public RootStatement() { int value = CommonHelperMethods.GetRandomPositiveInt0ToValue(1); if (value == 0) { this.conditionalLeftStatement = new ConditionalLeftStatement(1); } else { this.leftStatement = new LeftStatement(1); } }
/// <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) { byte nextByte = reader.ReadByte(); if (nextByte == StatementTypeEnum.ConditionalLeftStatement) { this.conditionalLeftStatement = new ConditionalLeftStatement(reader, 1); } else if (nextByte == StatementTypeEnum.LeftStatement) { this.leftStatement = new LeftStatement(reader, 1); } else { CommonHelperMethods.ThrowStatementParseException( nextByte, reader, new List <byte>() { StatementTypeEnum.ConditionalLeftStatement, StatementTypeEnum.LeftStatement }); } }