public void AddRainParticle(Vector3 pos) { Vector3 startPos = pos; for (int i = 0; i < 2; i++) { double velX = rnd.NextDouble() * 0.8 - 0.4; // [-0.4, 0.4] double velZ = rnd.NextDouble() * 0.8 - 0.4; double velY = rnd.NextDouble() + 0.4; Vector3 velocity = new Vector3((float)velX, (float)velY, (float)velZ); double xOffset = rnd.NextDouble() - 0.5; // [-0.5, 0.5] double yOffset = rnd.NextDouble() * 0.1 + 0.01; double zOffset = rnd.NextDouble() - 0.5; pos = startPos + new Vector3(0.5f + (float)xOffset, (float)yOffset, 0.5f + (float)zOffset); double life = 40; RainParticle p = AddParticle(rainParticles, ref rainCount, true); p.ResetState(pos, velocity, life); p.Big = rnd.Next(0, 20) >= 18; p.Tiny = rnd.Next(0, 30) >= 28; } }
public void AddRainParticle(Vector3 pos) { Vector3 startPos = pos; for (int i = 0; i < 2; i++) { double velX = rnd.NextDouble() * 0.8 - 0.4; // [-0.4, 0.4] double velZ = rnd.NextDouble() * 0.8 - 0.4; double velY = rnd.NextDouble() + 0.4; Vector3 velocity = new Vector3((float)velX, (float)velY, (float)velZ); double xOffset = rnd.NextDouble() - 0.5; // [-0.5, 0.5] double yOffset = rnd.NextDouble() * 0.1 + 0.01; double zOffset = rnd.NextDouble() - 0.5; pos = startPos + new Vector3(0.5f + (float)xOffset, (float)yOffset, 0.5f + (float)zOffset); double life = 40; RainParticle p = GetRainParticle(); p.ResetState(pos, velocity, life); int type = rnd.Next(0, 30); p.Size = (byte)(type >= 28 ? 2 : (type >= 25 ? 4 : 3)); } }