private void Init(M3DBubble bubble) { bubble.Size = RandomHelper.GetBoundedRnd(1, 3) / 1000.0f; bubble.X = 0.0f; bubble.Y = 0.0f; bubble.Z = 0.0f; }
private void Update(M3DBubble bubble, float waterHeight, out bool isSurfaced) { float vel = bubble.Size; float dx = (1 - RandomHelper.GetRandom(3)) / 1000.0f; float dz = (1 - RandomHelper.GetRandom(3)) / 1000.0f; float dy = vel; int num = RandomHelper.GetRandom(3); switch (num) { case 0: dx = 0.0f; break; case 1: dy = 0.0f; break; case 2: dz = 0.0f; break; } bubble.X += dx; bubble.Y += dy; bubble.Z += dz; isSurfaced = (bubble.Y >= waterHeight); }
public M3DAeration(int bubblesCount = 150) { fBubbles = new M3DBubble[bubblesCount]; for (int i = 0; i < bubblesCount; i++) { var bubble = new M3DBubble(); Init(bubble); fBubbles[i] = bubble; } }