Пример #1
0
        static void CreateBonuses(int bonusCount = 1)
        {
            for (int i = 0; i < bonusCount; i++)
            {
                Bonuses newBonus = new Bonuses();
                newBonus.X     = randomGen.Next(0, gameFieldHeight - 1);
                newBonus.Y     = randomGen.Next(0, gameFieldWidth - 1);
                newBonus.C     = '$';
                newBonus.Color = ConsoleColor.Red;

                while (gameField[newBonus.X, newBonus.Y] != 3)
                {
                    newBonus.X = randomGen.Next(0, gameFieldHeight);
                    newBonus.Y = randomGen.Next(0, gameFieldWidth);
                }
                bonuses.Add(newBonus);
                gameField[newBonus.X, newBonus.Y] = 4;
            }
            //PrintBonuses(bonuses);
        }
Пример #2
0
        static void CreateBonuses(int bonusCount = 1)
        {
            for (int i = 0; i < bonusCount; i++)
            {
                Bonuses newBonus = new Bonuses();
                newBonus.X = randomGen.Next(0, gameFieldHeight - 1);
                newBonus.Y = randomGen.Next(0, gameFieldWidth - 1);
                newBonus.C = '$';
                newBonus.Color = ConsoleColor.Red;

                while (gameField[newBonus.X, newBonus.Y] != 3)
                {
                    newBonus.X = randomGen.Next(0, gameFieldHeight);
                    newBonus.Y = randomGen.Next(0, gameFieldWidth);
                }
                bonuses.Add(newBonus);
                gameField[newBonus.X, newBonus.Y] = 4;
            }
            //PrintBonuses(bonuses);
        }