public static void Main(string[] args) { ConsoleManipulation HW_0 = new ConsoleManipulation(); // 1/2 Sound Engine, Sound Files are coded in VBScript currentviewport[2] = displayproperties[0]; currentviewport[3] = displayproperties[1]; MathHelper.GetFrameDurationFromRate(displayproperties[2]); // initilizes sound engine // ps1 ps1.FileName = "cscript.exe"; ps1.Arguments = string.Format("\"{0}\" \"{1}\" \"{2}\" \"{3}\" \"{4}\"", nologo1, scriptName1, abc1, name1, null); //This will equate to running via the command line: // > cscript.exe "C:\\Program Files\\KnightsRealm C#\\Assets\\Sounds\\sound1.vbs" "2" "sound1.vbs" // ps2 ps2.FileName = "cscript.exe"; ps2.Arguments = string.Format("\"{0}\" \"{1}\" \"{2}\" \"{3}\"", scriptName2, abc2, name2, null); // ps3 ps3.FileName = "cscript.exe"; ps3.Arguments = string.Format("\"{0}\" \"{1}\" \"{2}\" \"{3}\"", scriptName3, abc3, name3, null); // stores sound vars into an array for ease of access for later use ProcessStartInfo[] sounds = { ps1, ps2, ps3 }; Intro(); }
public static void GameEndedCongratAndReset(ref bool gameInProgress) { Console.SetCursorPosition(0, 15); ConsoleManipulation.ClearCurrentLine(); Console.WriteLine("\nCongratulations you escaped with {0} moves.\n", currentMoves); gameInProgress = false; gameEndedRecordScore = true; }
public static void PlayGame(Labyrinth labyrinth, int row, int col) { bool gameInProgress = true; currentMoves = 0; Console.WriteLine("\nEnter your move (Left Arrow = left, Right Arrow = right, Down Arrow = down, Up Arrow = up)"); Console.SetCursorPosition(0, 15); LabyrinthNavigation navigation = new LabyrinthNavigation(); while (gameInProgress) { ConsoleKeyInfo userChoice = Console.ReadKey(true); // Set currsor position outside of labyrinth and deletes previous turn message if any // I think this should be edited latter to not use magic numbers Console.SetCursorPosition(0, 15); ConsoleManipulation.ClearCurrentLine(); switch (userChoice.Key) { case ConsoleKey.LeftArrow: navigation.TryMoveLeft(labyrinth, ref gameInProgress, ref row, ref col); break; case ConsoleKey.RightArrow: navigation.TryMoveRight(labyrinth, ref gameInProgress, ref row, ref col); break; case ConsoleKey.DownArrow: navigation.TryMoveDown(labyrinth, ref gameInProgress, ref row, ref col); break; case ConsoleKey.UpArrow: navigation.TryMoveUp(labyrinth, ref gameInProgress, ref row, ref col); break; case ConsoleKey.T: PrintTopScores(scores); break; case ConsoleKey.R: gameInProgress = false; break; case ConsoleKey.E: Console.WriteLine("Good bye!"); Environment.Exit(0); break; default: Console.WriteLine("Invalid command!"); break; } } }