Example #1
0
        /// <summary>
        /// Asks the player which action they want to perform.
        /// </summary>
        /// <returns>Action number</returns>
        public static int GetGameAction()
        {
            GameWriter.DisplayGameOptions();
            var actionInput = ReadLine();
            int action;

            while (!int.TryParse(actionInput, out action) || action < 1 || action > 4)
            {
                GameWriter.ClearScreen();
                GameWriter.AskForNumberMessage(1, 3);
                GameWriter.DisplayGameOptions();
                actionInput = ReadLine();
            }

            GameWriter.ClearScreen();
            return(action);
        }
Example #2
0
        /// <summary>
        /// Asks the player which type of hero they want to play with.
        /// </summary>
        /// <returns>Hero type number</returns>
        public static int GetHeroType()
        {
            GameWriter.DisplayHeroOptions();
            var typeInput = ReadLine();
            int heroType;

            while (!int.TryParse(typeInput, out heroType) || heroType < 1 || heroType > 4)
            {
                GameWriter.ClearScreen();
                GameWriter.AskForNumberMessage(1, 4);
                GameWriter.DisplayHeroOptions();
                typeInput = ReadLine();
            }

            GameWriter.ClearScreen();
            return(heroType);
        }