Example #1
0
 void CheckChangeUnits()
 {
     if (currentScale < 1f || currentScale > 1E3f)
     {
         currentScale = Mathf.Clamp(currentScale, 1f, 1E3f);
         Units newUnits = ScaleUtility.GetNextScale(currentUnits, currentScale > 1f ? 1 : -1);
         currentScale = currentScale * ScaleUtility.ConvertUnitMultiplier(currentUnits, newUnits);
         currentUnits = newUnits;
     }
 }
Example #2
0
        float avogadro = 6.022E23f;         // agents/mol
        int NumberOfAgentsForConcentration(float concentration)
        {
            float volume = 4f / 3f * Mathf.PI * Mathf.Pow(spawnRadius * ScaleUtility.ConvertUnitMultiplier(currentUnits, Units.Centimeters), 3f) * 1E-3f;           //liters

            return(Mathf.RoundToInt(concentration * volume * avogadro));
        }