public override void SetupParticles() {//define as particulas if (prt_particles == null) { prt_particles = new Particula[prt_particleQty]; } float angle = 360.0f / prt_particleQty; for (int i = 0; i < prt_particleQty; ++i) { if (prt_particles[i] == null) { prt_particles[i] = new Particula(); } prt_particles[i].Setup( prt_position, new Vector2(prt_velocity.X * (float)Math.Cos(i * angle), prt_velocity.Y * (float)Math.Sin(i * angle)), prt_image, prt_maxLife, false, Constants.DEATH_RULE_LIFETIME ); } }
public override void SetupParticles() {//define as particulas if (prt_particles == null) { prt_particles = new Particula[prt_particleQty]; } float angle = 90.0f / prt_particleQty; for (int i = 0; i < prt_particleQty; ++i) {//instancia uma nova particula ate alcançar o maximo definido if (prt_particles[i] == null) { prt_particles[i] = new Particula(); } Random rand = new Random(DateTime.Now.Millisecond); double posY = (rand.NextDouble() * Constants.SCREEN_HEIGHT - 1) - 1.0; //randomiza a posicao x e y de acordo com a altura e largura da tela double posX = (rand.NextDouble() * Constants.SCREEN_WIDTH - 1) - 1.0; prt_particles[i].Setup( new Vector2((float)posX, (float)posY), new Vector2(prt_velocity.X * (float)Math.Cos(i * angle), prt_velocity.Y * (float)Math.Sin(i * angle)), prt_image, prt_maxLife, true, Constants.DEATH_RULE_COLLISION_AT_BOTTOM ); } }