Exemple #1
0
        /// <summary>
        /// Processes menu selection for DisplaySetupMenu
        /// </summary>
        /// <param name="menuChoice"></param>
        /// <param name="myFinch"></param>
        /// <param name="myFinchOperator"></param>
        static bool SettingsSwitchBoard(string menuChoice, Finch myFinch, FinchOperator myFinchOperator)
        {
            // local variables:
            bool returnToPrevious = false;

            switch (menuChoice.ToUpper())
            {
            case "1":
                FinchOperator.EstablishFinchConnection(myFinch);
                break;

            case "2":
                GetDifficultySetting(myFinchOperator);
                DifficultySettings(myFinchOperator);
                break;

            case "3":
                DisplayWelcomeScreen();
                break;

            case "M":
                returnToPrevious = true;
                break;

            default:
                Console.WriteLine("'{0}' is not a valid input. Please try again!", menuChoice);
                DisplayContinuePrompt();
                Console.Clear();
                break;
            }

            return(returnToPrevious);
        }
Exemple #2
0
        /// <summary>
        /// Screen that runs the gameplay:
        /// </summary>
        /// <param name="myFinch"></param>
        /// <param name="myFinchOperator"></param>
        /// <param name="difficulty"></param>
        static void DisplayGameInProgress(Finch myFinch, FinchOperator myFinchOperator)
        {
            // Instantiates a new hit tracker:
            Monitor hitTracker = new Monitor();
            int     timeInLoop = 0;

            //Variables:
            myFinchOperator.isDefeated = false;

            // Resets Finch Operator to default hitpoints.
            myFinchOperator.HitsSuffered = 0;


            DisplayHeader("DARTH FINCH");
            Console.WriteLine();

            Console.WriteLine("\t\tInitializing...");

            // Just in case the user attempts to run the game without a Finch - it doesn't crash, but it doesn't make sense either.
            if (!myFinch.connect())
            {
                DisplayHeader("DARTH FINCH");
                Console.WriteLine("\tNo finch detected. Please connect a Finch before proceeding!");
                DisplayContinuePrompt();
                FinchOperator.EstablishFinchConnection(myFinch);
            }

            // Little indicator that the game has begun:
            FinchOperator.PlayImpMarchShort(myFinch);

            // Main Gameplay Loop:
            while (!myFinchOperator.isDefeated && timeInLoop <= myFinchOperator.TimeAvailable)
            {
                DisplayHeader("DARTH FINCH:");

                Console.WriteLine("\tDarth Finch is active!");
                Console.WriteLine("\tTime Remaining:" + $"[{myFinchOperator.TimeAvailable - timeInLoop}]");
                DisplayHealthStatus(myFinchOperator);

                //hitTracker.IsFrozen = Monitor.FreezeDetection(myFinch);
                //hitTracker.IsHit = Monitor.HitDetection(myFinch);

                DisplayVulnerbilityStatus(myFinch, hitTracker, myFinchOperator);
                myFinch.wait(500);

                myFinchOperator.isDefeated = CheckHealth(myFinchOperator);

                FinchOperator.LEDSettings(myFinch, myFinchOperator);
                // FinchOperator.MotorSettings(myFinch, myFinchOperator); Disabling this for the time being.
                myFinch.wait(500);
                timeInLoop++;
            }
        }
        /// <summary>
        /// Plays the Imperial March on the finch. WARNING: VERY LONG CODE BLOCK - CLOSE WHEN NOT IN USE
        /// </summary>
        /// <param name="myFinch"></param>
        public static void PlayImpMarch(Finch myFinch)
        {
            // Just in case the user attempts to run the game without a Finch - it doesn't crash, but it doesn't make sense either.
            if (!myFinch.connect())
            {
                DisplayHeader("DARTH FINCH");
                Console.WriteLine("\tNo finch detected. Please connect a Finch before proceeding!");
                DisplayContinuePrompt();
                FinchOperator.EstablishFinchConnection(myFinch);
            }

            DisplayHeader("DARTH FINCH");
            Console.WriteLine("\tDarth Finch is amused by your request, but is willing to humor you.");
            Console.WriteLine("\t(Please allow the Finch to finish, you will see a continue prompt when it is done)");

            // Source for notes: http://llrprt.blogspot.com/2013/11/programming-imperial-march.htmlhttp://llrprt.blogspot.com/2013/11/programming-imperial-march.html

            myFinch.wait(1000);
            myFinch.noteOn(440);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(440);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(440);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(349);
            myFinch.wait(350);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(523);
            myFinch.wait(150);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(440);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(349);
            myFinch.wait(350);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(523);
            myFinch.wait(150);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(440);
            myFinch.wait(1000);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(659);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(659);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(659);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(698);
            myFinch.wait(350);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(523);
            myFinch.wait(150);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(415);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(349);
            myFinch.wait(350);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(523);
            myFinch.wait(150);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(440);
            myFinch.wait(1000);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(800);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(440);
            myFinch.wait(350);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(440);
            myFinch.wait(150);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(880);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(830);
            myFinch.wait(250);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(784);
            myFinch.wait(250);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(740);
            myFinch.wait(125);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(698);
            myFinch.wait(125);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(740);
            myFinch.wait(250);
            myFinch.noteOff();
            myFinch.wait(250);

            myFinch.noteOn(455);
            myFinch.wait(250);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(622);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(587);
            myFinch.wait(250);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(554);
            myFinch.wait(250);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(523);
            myFinch.wait(125);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(466);  // I wasn't kidding when I said this was long.
            myFinch.wait(125);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(523);
            myFinch.wait(250);
            myFinch.noteOff();
            myFinch.wait(250);

            myFinch.noteOn(349);
            myFinch.wait(125);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(415);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(349);
            myFinch.wait(375);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(440);
            myFinch.wait(125);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(523);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(440);
            myFinch.wait(375);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(523);
            myFinch.wait(125);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(659);
            myFinch.wait(1000);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(880);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(440);
            myFinch.wait(350);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(440);
            myFinch.wait(150);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(880);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(830);
            myFinch.wait(250);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(784);
            myFinch.wait(250);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(740);
            myFinch.wait(125);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(698);
            myFinch.wait(125);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(740);
            myFinch.wait(250);
            myFinch.noteOff();
            myFinch.wait(250);

            myFinch.noteOn(455);
            myFinch.wait(250);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(622);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(587);
            myFinch.wait(250);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(554);
            myFinch.wait(250);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(523);
            myFinch.wait(125);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(466);
            myFinch.wait(125);
            myFinch.noteOff();
            myFinch.wait(10);



            myFinch.noteOn(523);
            myFinch.wait(250);
            myFinch.noteOff();
            myFinch.wait(250);

            myFinch.noteOn(349);
            myFinch.wait(250);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(415);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(349);
            myFinch.wait(375);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(261);
            myFinch.wait(125);
            myFinch.noteOff();
            myFinch.wait(10);

            myFinch.noteOn(475);
            myFinch.wait(1000);
            myFinch.noteOff();
            myFinch.wait(100);
        }