// Build square table, where each row and column has all molecules for the level public void SetUpTable(string[] allMolecules) { table = new ReactionTableEntry[allMolecules.Length][]; for (int i = 0; i < allMolecules.Length; i++) { moleculeIndices.Add (allMolecules [i], i); table[i] = new ReactionTableEntry[allMolecules.Length]; for (int x = 0; x < allMolecules.Length; x++) { table [i] [x] = null; } } }
public void SetPressure(ReactionTableEntry.Pressure pressure) { this.pressure = pressure; }
public void SetTemperature(ReactionTableEntry.Temperature temperature) { this.temperature = temperature; }
//All of the reaction data and entries will be initialized and populated here private void PopulateReactionTable() { reactionTable.SetUpTable(new string[] { "C", "O2", "CO2", "CH4", "CaCO3"}); ReactionTableEntry reaction1 = new ReactionTableEntry(new string[] {"CO2", "H2O"}, ReactionTableEntry.Move.none, ReactionTableEntry.Temperature.lo, ReactionTableEntry.Pressure.lo); ReactionTableEntry reaction2 = new ReactionTableEntry(new string[] {"CaCO3"}, ReactionTableEntry.Move.none, ReactionTableEntry.Temperature.med, ReactionTableEntry.Pressure.med); reactionTable.RegisterReaction("CH4", "O2", reaction1); reactionTable.RegisterReaction("CO2", "CaO", reaction2); }
// Define a reaction, where two molecules react to create an array of products public void RegisterReaction(string molecule1, string molecule2, ReactionTableEntry entry) { table [moleculeIndices [molecule1]] [moleculeIndices [molecule2]] = entry; }