Exemple #1
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here

            player.LoadContent(Content);
            ballModel.LoadContent(Content);
            terrainModel.LoadContent(Content);
            font                        = Content.Load <SpriteFont>("default_font");
            levelUp                     = Content.Load <SoundEffect>("level_up");
            ballColors                  = Content.Load <BallColorContent>("ballcolors");
            rainParticles               = new ParticleSystem(_graphics.GraphicsDevice, 500, ballModel.ImpactTexture);
            rainParticles.BlendState    = BlendState.Opaque;
            rainParticles.SpawnPerFrame = 5;
            rainParticles.SpawnParticle = (ref Particle p, Random r) =>
            {
                p.acceleration = Vector2.Zero;
                p.color        = Color.CornflowerBlue;
                p.life         = 1f;
                p.scale        = 1;
                p.velocity     = new Vector2(0, 1000);
                p.position     = new Vector2((float)(r.NextDouble() * 2.0f - 1.0f) * WorldSize, 0);
            };
            rainParticles.UpdateParticle = ParticleSystem.DefaultParticleUpdater;
            AddBall();
        }