#Code doing some illogical stuff

1 messages · Page 1 of 1 (latest)

vernal sky
#

Hey guys. I'm having an issue. Somehow, depending on the configuration I collide my gameobject with, AKA gameobject1 + gameobject2 or gameobject2 + gameobject1 I get different result. It all comes down to this: productAmount = reactantAmount[fetchNameReactant] * DatabaseReader.Instance.compoundInfo[equationFormat1].MolecularMass[i] / copyStechiometry[i];
copyStechiometry being:

        decimal[] copyStechiometry;
        if (!reverseOutput)
        {
            copyStechiometry = DatabaseReader.Instance.compoundInfo[equationFormat1].Stechiometry;
        } else
        {
            copyStechiometry = DatabaseReader.Instance.compoundInfo[equationFormat2].Stechiometry;
        }
        Array.Reverse(copyStechiometry);```
Thing is the output should stay the same because aside from copyStechiometry, which changes for some reason, `reactantAmount` and `MolecularMass` as well as `i` don't change, no matter the combination. I am using the following part of json to conduct those mathematical operations:
```json
{  
"Na + H2O": {
    "Output": ["NaOH", "H2"],
    "Balanced": "2Na + 2H2O → 2NaOH + H2",
    "Exothermic": true,
    "State": [ "(s)", "(aq)" ],
    "StateProducts": ["(aq)", "(g)"],
    "MolecularMass": [ 80, 2 ],
    "Stechiometry": [ 36, 46 ]
  }
}```
vernal sky
#

revival time :troll: