//! This function is called at each frame public void Update() { if (_paused) { Logger.Log("ReactionEngine::Update paused", Logger.Level.TRACE); } else { _fick.react(); if (enableShufflingMediumOrder) { LinkedListExtensions.Shuffle <Medium>(_mediums); } foreach (Medium medium in _mediums) { medium.Update(); } Logger.Log("ReactionEngine::Update() update of mediums done", Logger.Level.TRACE); if (!enableSequential) { foreach (Medium medium in _mediums) { medium.updateMoleculesConcentrations(); } Logger.Log("ReactionEngine::Update() update of mol cc in mediums done", Logger.Level.TRACE); } } }
/*! * \brief Execute everything about simulation into the Medium */ public void Update() { if (enableShufflingReactionOrder) { LinkedListExtensions.Shuffle <IReaction>(_reactions); } foreach (IReaction reaction in _reactions) { if (Logger.isLevel(Logger.Level.TRACE)) { PromoterReaction promoter = reaction as PromoterReaction; if (promoter != null) { Logger.Log("Medium::Update reaction.react(" + _molecules + ") with reaction=" + reaction, Logger.Level.TRACE); } } reaction.react(_molecules); } applyVariation(); if (_enableNoise) { float noise; foreach (Molecule m in _molecules) { noise = _numberGenerator.getNumber(); if (_enableSequential) { m.addConcentration(noise); } else { m.addNewConcentration(noise); } } } //TODO improve check that it's the medium of the hero bacterium Cellia //TODO refactor interactions out of medium if (_name == "Cellia") { manageMoleculeConcentrationWithKey("AMPI"); if (GameStateController.isAdminMode) { //TODO manage this differently manageMoleculeConcentrationWithKey("AMPR"); manageMoleculeConcentrationWithKey("ATC"); manageMoleculeConcentrationWithKey("FLUO1"); manageMoleculeConcentrationWithKey("FLUO2"); manageMoleculeConcentrationWithKey("IPTG"); manageMoleculeConcentrationWithKey("MOV"); manageMoleculeConcentrationWithKey("REPR1"); manageMoleculeConcentrationWithKey("REPR2"); manageMoleculeConcentrationWithKey("REPR3"); manageMoleculeConcentrationWithKey("REPR4"); } } }