예제 #1
0
 protected void Start()
 {
     m_endP1Display.Hide(true);
     m_endP2Display.Hide(true);
     m_endTieDisplay.Hide(true);
     m_buttomMappingDisplay.Hide(true);
     m_scoreDisplay.Hide(true);
     m_timerDisplay.Hide(true);
     m_titleDisplay.Show(true);
     m_blackout.Show(true);
 }
예제 #2
0
        public void Hide()
        {
            team1display.Hide();
            team2display.Hide();

            metre.MoveTo(metre.Position + new Vector2(0, -20), 1000, EasingTypes.Out);
            metre2.MoveTo(metre2.Position + new Vector2(0, -20), 1000, EasingTypes.Out);
            team1header.Position += new Vector2(0, -20);
            team2header.Position += new Vector2(0, -20);

            // hide all scoreboards
            foreach (ScoreboardEntry s in player.ScoreEntries)
            {
                if (s != null)
                {
                    s.Hide();
                }
            }
        }
예제 #3
0
        private void timerTick(object sender, EventArgs e)
        {
            var cheerTimer = new Timer();

            cheerTimer.Interval = 3000;
            cheerTimer.Tick    += (s, trigger) =>
            {
                ScoreDisplay.Hide();
                cheerTimer.Stop();
            };

            if (playerScore < 10)
            {
                playerScoreboard.Text = "0" + playerScore;
            }
            else
            {
                playerScoreboard.Text = "" + playerScore;
            }

            if (cpuScore < 10)
            {
                cpuScoreboard.Text = "0" + cpuScore;
            }
            else
            {
                cpuScoreboard.Text = "" + cpuScore;
            }

            ball.Top  -= ballY;
            ball.Left -= ballX;

            cpu.Top += cpuSpeed;

            if (cpu.Top < 0 || cpu.Top + cpu.Height > ClientSize.Height)
            {
                cpuSpeed = -cpuSpeed;
            }

            if (goUp && player.Top > 0 && !goDown)
            {
                player.Top -= 8;
            }
            if (goDown && player.Top + player.Height < ClientSize.Height && !goUp)
            {
                player.Top += 8;
            }

            if (ball.Top < 0 || ball.Top + ball.Height > ClientSize.Height)
            {
                ballY = -ballY;
            }

            if (ball.Left < 0)
            {
                ball.Left = this.Width / 2;
                ballX     = -ballX;
                //ballX -= 2;
                playerScore++;
                ScoreDisplay.Text = "Player scores!";
                if (ScoreDisplay.Visible == true)
                {
                    cheerTimer.Stop();
                }
                else
                {
                    ScoreDisplay.Show();
                }
                cheerTimer.Start();
            }
            if (ball.Left > ClientSize.Width)
            {
                ball.Left = ClientSize.Width / 2;
                ballX     = -ballX;
                //ballX += 2;
                cpuScore++;
                ScoreDisplay.Text = "CPU scores!";
                if (ScoreDisplay.Visible == true)
                {
                    cheerTimer.Stop();
                }
                else
                {
                    ScoreDisplay.Show();
                }
                cheerTimer.Start();
            }
            if (ball.Bounds.IntersectsWith(player.Bounds) || ball.Bounds.IntersectsWith(cpu.Bounds))
            {
                ballX = -ballX;
            }

            if (playerScore >= 10)
            {
                gameTimer.Stop();
                MessageBox.Show("Player wins");
            }
        }