Exemplo n.º 1
0
        public override void Draw(Renderer2D renderer, GameTime time)
        {
            renderer.Begin(cam.Transform);
            TimeWatcher.Start("Map.Draw");
            w.map.Draw(renderer, cam.Transform);
            TimeWatcher.End();
            renderer.End();

            if (debug)
            {
                renderer.Begin(cam.Transform);
                DebugRenderer.DrawWorld(renderer, time);
                renderer.End();

                renderer.Begin();
                DebugRenderer.DrawScreen(renderer, time);
                renderer.End();
            }
        }
Exemplo n.º 2
0
        public override void Update(UpdateContainer container)
        {
            DebugRenderer.Update(container);
            if (container.Keyboard.IsKeyPressed(Keys.U))
            {
                followedNPC = (followedNPC + 1) % w.npcs.Count;
                cam.Follow  = w.npcs[followedNPC];
            }

            if (container.Keyboard.IsKeyPressed(Keys.N))
            {
                debug = !debug;
            }

            TimeWatcher.Start("World.Update");
            w.Update(container.Time);
            TimeWatcher.End();
            TimeWatcher.Start("Camera.Update");
            cam.Update(container.Time);
            TimeWatcher.End();
        }
Exemplo n.º 3
0
 private void StartStopGame(object sender, EventArgs e)
 {
     if (StartStop.Text == "Start")
     {
         StartStop.Text = "Pause";
         if (Level == 1)
         {
             if (start)
             {
                 EnemiesSpawner();
                 start = false;
             }
             IntersectionsDetecter.Start();
             TimeWatcher.Start();
             EnemiesMover.Start();
             BulletChecker.Start();
             ScoreTimePan.Click += new EventHandler(BulletMaker);
             this.Click         += new EventHandler(BulletMaker);
             this.KeyDown       += new KeyEventHandler(Level1_KeyDown);
             this.ActiveControl  = null;
         }
         else
         {
             if (start)
             {
                 EnemiesSpawner();
                 start = false;
             }
             IntersectionsDetecter.Start();
             EnemiesMover.Start();
             BulletChecker.Start();
             ScoreTimePan.Click += new EventHandler(BulletMaker);
             this.Click         += new EventHandler(BulletMaker);
             this.KeyDown       += new KeyEventHandler(Level1_KeyDown);
             this.ActiveControl  = null;
             RandomEnemyBullets.Start();
             WinOrLose.Start();
         }
     }
     else
     {
         StartStop.Text = "Start";
         if (Level == 1)
         {
             IntersectionsDetecter.Stop();
             TimeWatcher.Stop();
             EnemiesMover.Stop();
             BulletChecker.Stop();
             ScoreTimePan.Click -= new EventHandler(BulletMaker);
             this.Click         -= new EventHandler(BulletMaker);
             this.KeyDown       -= new KeyEventHandler(Level1_KeyDown);
         }
         else
         {
             IntersectionsDetecter.Stop();
             EnemiesMover.Stop();
             BulletChecker.Stop();
             ScoreTimePan.Click -= new EventHandler(BulletMaker);
             this.Click         -= new EventHandler(BulletMaker);
             this.KeyDown       -= new KeyEventHandler(Level1_KeyDown);
             this.ActiveControl  = null;
             RandomEnemyBullets.Stop();
             WinOrLose.Stop();
         }
     }
 }