예제 #1
0
 public new void MoveLeft()
 {
     if (leftBracket.positionX > 1)
     {
         leftBracket.MoveLeft();
         dwarf.MoveLeft();
         rightBracket.Hide();
         rightBracket.MoveLeft();
         leftBracket.Show();
         dwarf.Show();
         rightBracket.Show();
     }
 }
예제 #2
0
 public Dwarf(int fieldWidth, int fieldHeight)
 {
     leftBracket  = new ScreenElements(fieldWidth / 2 - 1, fieldHeight - 2, '(', 15);
     dwarf        = new ScreenElements(fieldWidth / 2, fieldHeight - 2, 'O', 15);
     rightBracket = new ScreenElements(fieldWidth / 2 + 1, fieldHeight - 2, ')', 15);
     leftBracket.Show();
     dwarf.Show();
     rightBracket.Show();
     this.fieldWidth = fieldWidth;
     this.dwarfLives = 3;
     this.ShowLives();
 }
 public Dwarf(int fieldWidth, int fieldHeight)
 {
     leftBracket = new ScreenElements(fieldWidth / 2 - 1, fieldHeight - 2, '(', 15);
     dwarf = new ScreenElements(fieldWidth / 2, fieldHeight - 2, 'O', 15);
     rightBracket = new ScreenElements(fieldWidth / 2 + 1, fieldHeight - 2, ')', 15);
     leftBracket.Show();
     dwarf.Show();
     rightBracket.Show();
     this.fieldWidth = fieldWidth;
     this.dwarfLives = 3;
     this.ShowLives();
 }
        /* ------------------------------------------------------------------------ Rocks Management ----------------------------------------------------------------*/
        public static void ManageRocks()
        {
            int count = 0;

            while (runFlag)
            {
                SetCounter(10);
                count++;
                if (shoot)
                {
                    bullet.Hide();
                    bullet.MoveUp();
                    if (bullet.positionY > 2)
                    {
                        bullet.Show();
                    }
                    else
                    {
                        bullet.positionX = 0;
                        bullet.positionY = 0;
                        shoot            = false;
                    }
                }
                lock (syncObject)
                {
                    Console.SetCursorPosition(fieldWidth - 30, 0);
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.Write("({0})", 10 - count);
                }

                if (count >= 10)
                {
                    GetSpecialRock();
                    rocksDensity--;
                    SetRocksSpeed(-30);
                    level++;
                    SetLevel();
                    SetWind();
                    count = 0;
                }
                ManageLists(bonusRocks);
                GetNewRocks(quickerRocks, 3);
                ManageLists(quickerRocks);
                Thread.Sleep(rocksSpeed / 5);
                ManageLists(bonusRocks);
                GetNewRocks(quickerRocks, 3);
                ManageLists(quickerRocks);
                Thread.Sleep(rocksSpeed / 5);
                ManageLists(bonusRocks);
                GetNewRocks(quickRocks, 2);
                ManageLists(quickRocks);
                GetNewRocks(slowRocks, 1);
                ManageLists(slowRocks);
                Thread.Sleep(rocksSpeed / 5);
                ManageLists(bonusRocks);
                GetNewRocks(quickerRocks, 3);
                ManageLists(quickerRocks);
                Thread.Sleep(rocksSpeed / 5);
                GetNewRocks(quickRocks, 2);
                ManageLists(quickRocks);
                if (soundFlag)
                {
                    //System.Media.SystemSounds.Asterisk.Play();
                    //System.Media.SystemSounds.Beep.Play();
                    //System.Media.SystemSounds.Exclamation.Play();
                    //System.Media.SystemSounds.Hand.Play();
                    //System.Media.SystemSounds.Question.Play();
                    Console.Beep(500, 10);
                }

                Thread.Sleep(rocksSpeed / 5);
            }
        }