Пример #1
0
        private void PaintTimer_Tick(object sender, EventArgs e)
        {
            Mechanics.Move(spaceShip1);
            Mechanics.Move(spaceShip2);

            Mechanics.LapCount(spaceShip1, startLine, middleCheckPoint);
            Mechanics.LapCount(spaceShip2, startLine, middleCheckPoint);

            if (spaceShip1.LapCount == 3 || spaceShip2.LapCount == 3)
            {
                Mechanics.Winner(spaceShip1, spaceShip2);
            }

            Collisions.Walls(spaceShip1, outsideBound, insideBound);
            Collisions.Walls(spaceShip2, outsideBound, insideBound);

            Collisions.Players(spaceShip1, spaceShip2);

            panel1.Refresh();
        }
Пример #2
0
        public static void Winner(SpaceShip spaceShip1, SpaceShip spaceShip2)
        {
            if (spaceShip1.LapCount == 3)
            {
                spaceShip1.LapCount = 0;
                spaceShip2.LapCount = 0;
                Collisions.RestartPositions(spaceShip1);
                Collisions.RestartPositions(spaceShip2);

                MessageBox.Show($"Player {spaceShip1.PlayerNumber} is the winner!", "WINNER WINNER WINNER");
            }

            else if (spaceShip2.LapCount == 3)
            {
                spaceShip1.LapCount = 0;
                spaceShip2.LapCount = 0;
                Collisions.RestartPositions(spaceShip1);
                Collisions.RestartPositions(spaceShip2);
                MessageBox.Show($"Player {spaceShip2.PlayerNumber} is the winner!", "WINNER WINNER WINNER");
            }
        }