private SingleLineText LivesLeftLine() { string livesLeftString = "Lives: " + LivesLeft.ToString(); SingleLineText lives = new SingleLineText(livesLeftString, new Coordinates(5, Console.WindowWidth - 10)); return(lives); }
public void Start() { int linesCounter = 0; int skippedLinesAfterAddingWord = 2; while (true) { painter.PrintField(); if (inBossFight && activeObjects.Count == 0) { TickTime = 6; inBossFight = false; } if (points % enteringBossFightLimit == (enteringBossFightLimit - 1)) { TickTime = 20; inBossFight = true; } if (TickOnGivenLoop(TickTime)) { MoveActiveObjects(); if (inBossFight) { BossFight(); } else { JustEnteringInBossFight = true; if (++linesCounter == skippedLinesAfterAddingWord) { SingleLineText line = new SingleLineText(generator.NewWord()); activeObjects.Add(line); linesCounter = 0; } } } System.Threading.Thread.Sleep(10); keyboard.ProcessInput(); painter.ClearField(); Console.Clear(); painter.InsertIntoField(LivesLeftLine()); painter.InsertIntoField(scoreObject); RemoveInactiveWords(); if (LivesLeft < 0) { break; } } }
SoundPlayer bossFight = new SoundPlayer(@"..\..\Sounds\BossFight.wav"); // intro sound of the boss fight //SoundPlayer bossFight = new SoundPlayer(@"BossFight.wav"); public Game(Keyboard keyBoard) { LivesLeft = 5; viewFieldWidth = Console.WindowWidth - 1; activeObjects = new List <GameObject>(); painter = new Painter(Console.WindowHeight - 1, viewFieldWidth); bossBlocksDataBase = new List <string[]>(); BlockReader bossReader = new BlockReader(@"..\...\TextFiles\Boss.txt"); //BlockReader bossReader = new BlockReader(@"Boss.txt"); while (!bossReader.End()) //This shoul be in another class but we dont have time { bossBlocksDataBase.Add(bossReader.NextBlock()); } scoreObject = new SingleLineText("Score: 0", new Coordinates(3, Console.WindowWidth - 10)); reader = new WordReader(@"..\..\TextFiles\WordsDictionary.txt"); //reader = new WordReader(@"WordsDictionary.txt"); generator = new WordGenerator(CreateWordDataBase()); this.keyboard = keyBoard; selectedObject = null; inBossFight = false; points = 0; }
private void CreateScoreObject() { string score = "Score: " + points; scoreObject = new SingleLineText(score, new Coordinates(3, Console.WindowWidth - 10)); }