Exemplo n.º 1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            switch (GameState)
            {
            case GameStates.InGame:
                e.Graphics.TranslateTransform(View.MapZeroPoint.X, View.MapZeroPoint.Y);
                View.DrawMap(e, Level);
                View.DrawCreatures(e, Level, GlobalTime);
                View.DrawTerrain(e, Level);
                View.DrawHitAnimation(e, Level, GlobalTime);
                if (PlayerView)
                {
                    View.DrawLineFromPlayer(e, Level, ClientCursor);
                }
                if (HitBoxes)
                {
                    View.DrawHitBoxes(e, Level);
                }
                View.DrawUserInterface(e, Level);
                //e.Graphics.DrawString(Level.LevelTime.ToString(), new Font("Arial", 10), Brushes.Red, new PointF(400, 400));
                break;

            case GameStates.Over:
                e.Graphics.DrawString("GAME OVER", new Font("Arial", 30), Brushes.Black,
                                      new Point(ClientSize.Width / 2 - 150, ClientSize.Height / 2 - 100));
                e.Graphics.DrawString($"Score: {Model.Score}", new Font("Arial", 20), Brushes.Black,
                                      new Point(ClientSize.Width / 2 - 70, ClientSize.Height / 2 - 50));
                break;

            case GameStates.MainMenu:
                e.Graphics.DrawString($"Score: {Model.Score}", new Font("Arial", 20), Brushes.Black,
                                      new Point(ClientSize.Width / 2 - 70, ClientSize.Height / 2 - 50));
                break;
            }
        }