private void SanityCheck() { float sum = 0; foreach (var weight in m_weights) { sum += weight; } if (Floats.Quantize(sum - 1f, 0.00001f) != 0f) { Debug.LogWarningFormat("Failed WeightedRandom sanity check, total is {0}", sum); } }
public static Vector2 Quantize(Vector2 position, float accuracy) { return(new Vector2( Floats.Quantize(position.x, accuracy), Floats.Quantize(position.y, accuracy))); }