Esempio n. 1
0
        private void pictureBox_Paint(object sender, PaintEventArgs e)
        {
            TimeSpan time = DateTime.Now - lastTime;

            lastTime = DateTime.Now;
            double dTime = time.TotalMilliseconds / 20;

            game.Update(1);

            watersView = new EntityView(e.Graphics, game.waters.Cast <Entity>().ToList(), new Bitmap(Properties.Resources.water), 20);
            watersView.Draw();

            appleView = new EntityView(e.Graphics, game.apples.Cast <Entity>().ToList(), new Bitmap(Properties.Resources.apple), 20);
            appleView.Draw();

            kolobokView = new EntityView(e.Graphics, game.kolobok, KolobokAnim(), 20);
            kolobokView.Draw();

            tankskView = new EntityView(e.Graphics, game.tanks.Cast <Entity>().ToList(), new Bitmap(Properties.Resources.tank), 20);
            tankskView.Draw();

            wallsView = new FastEntityView(e.Graphics, game.walls.Cast <Entity>().ToList(), new Bitmap(Properties.Resources.wall), 20);
            wallsView.Draw();

            bulletsView = new EntityView(e.Graphics, game.bullets.Cast <Entity>().ToList(), new Bitmap(Properties.Resources.bullet), 20);
            bulletsView.Draw();

            explosionsView = new EntityView(e.Graphics, game.explosions.Cast <Entity>().ToList(), ExplosionAnim(), 20);
            explosionsView.Draw();

            labelScore.Text = string.Format("Score: {0}", game.Score);
        }