コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool GetAndExecuteMenuChoice(Player p, BurstABubble game)
        {
            int userChoice = GetValidUserInput(getMenuAsString(), 0, 4);

            switch (userChoice)
            {
            case 0:     // "0 - Throw a normal rock"
                return(game.CreateRock(p));

            // break isn't needed because the return on the previous line will end this case
            case 1:     // "1 - Light a firework at the bubbles"
                return(game.CreateFireWorks(p));

                break;  // We can leave the break in, but we'll get a compiler warning :)

            case 2:     // "2 - Wait a round"
                return(game.Wait(p));

            case 3:     // "3 - Quit the game"
                return(game.Quit(p));

            default:
                // We should never get here
                // but just in case we'll return true
                // (which means that we want the game to continue running - false would exit the game)
                return(true);
            }
        }
コード例 #2
0
 /// <summary>
 ///
 /// </summary>
 public MenuCUI(BurstABubble b)
 {
     m_mainGameData = b;
 }
コード例 #3
0
        static void Main(string[] args)
        {
            BurstABubble b = new BurstABubble();

            b.PlayGame();
        }