static void Main(string[] args) { // Objects used by engine String lcTempInput = ""; // =============== INSTANTIATE ASSETS ======================== // // Everything related to the character Character mainCharacter = new Character(); // Everything related to the map including descriptions, directions // and player/item locations WorldMap worldMap = new WorldMap(); // Input processing class GetUserInput getUserInput = new GetUserInput(); // The Game Handler actually runs the game. GameHandler gameHandler = new GameHandler(ref mainCharacter, ref worldMap, ref getUserInput); // ================ GET PLAYER INFO ========================== // Console.Write("Welcome brave adventurer!\n\nWhat is thy name?\n> "); lcTempInput = getUserInput.getStringFromConsole(); Console.WriteLine("Pleased to make your acquiantance " + lcTempInput + "\n"); mainCharacter.SetPlayerName(lcTempInput); Console.WriteLine("If need assistance, you may enter HELP at any time.\n"); // Intro location and Character info Console.WriteLine(worldMap.GetDescription()); Console.WriteLine(mainCharacter.GetPlayerStatusFull()); // =============== MAIN LOOP ===================== // // This routine will run the game. When it exits, we are done. gameHandler.RunGame(); // ============= END MAIN LOOP =================== // Console.WriteLine("Thank you for playing " + mainCharacter.GetPlayerName()); // Clean exit System.Environment.Exit(0); }
// Store the references passed in on start public GameHandler(ref Character acMainCharacter, ref WorldMap acWorldMap, ref GetUserInput acGetUserInput) { mainCharacter = acMainCharacter; worldMap = acWorldMap; getUserInput = acGetUserInput; }