예제 #1
0
        static void Main(string[] args)
        {
            Generic_Display display = new Generic_Display();
            Generic_Input   input   = new Generic_Input();
            Generic_Alter   alter   = new Generic_Alter();

            SeaMonster big = new SeaMonster();

            InitializeSeaMonsterBig(big);

            FurryMonster jodi = new FurryMonster();

            InitializeFurryMonsterJodi(jodi);

            List <SeaMonster>   seaMonsters   = new List <SeaMonster>();
            List <FurryMonster> furryMonsters = new List <FurryMonster>();

            seaMonsters.Add(big);
            furryMonsters.Add(jodi);

            bool exit = false;

            display.DisplayOpenScreen("Sea Monster Classes", "temp", new string[1] {
                "Eric Grant"
            });

            do
            {
                exit = MainMenu(seaMonsters, furryMonsters, display);
            } while (!exit);
        }
예제 #2
0
        public static VideoGame DisplayGetGame(Generic_Input GI)
        {
            VideoGame newGame = new VideoGame();

            Console.WriteLine("Enter Game Title:");
            Console.Write(">");
            newGame.Title = Console.ReadLine();
            Console.WriteLine();

            Console.WriteLine("Enter Game Publisher:");
            Console.Write(">");
            newGame.Publisher = Console.ReadLine();
            Console.WriteLine();

            Console.WriteLine("Enter Game Price:");
            newGame.Price = GI.GetValidDouble();
            Console.WriteLine();

            Console.WriteLine("Is Game Multiplayer:");
            Console.Write(">");
            newGame.Multiplayer = bool.Parse(Console.ReadLine());
            Console.WriteLine();

            return(newGame);
        }
예제 #3
0
        static void DisplayUserAddFurryMonsters(List <FurryMonster> furryMonsters, Generic_Display display)
        {
            Generic_Input    input = new Generic_Input();
            FurryMonsterType monsterType;
            string           uInput;
            int year, month, day;

            display.DisplayNewScreen("Monster Maker");

            FurryMonster furryMonster = new FurryMonster();

            Console.WriteLine("Enter monster name:");
            furryMonster.Name = input.GetString(false);

            Console.WriteLine("Enter monster color:");
            furryMonster.Color = input.GetString(false);

            Console.WriteLine("Does monster have claws (true or false):");
            furryMonster.HasClaws = input.GetBool();

            Console.WriteLine("Enter monster length in meters:");
            furryMonster.Length = input.GetValidInt();

            Console.WriteLine("When was the monster born.");
            Console.WriteLine("Year:");
            do
            {
                year = input.GetValidInt();
            } while (year < 0 || year > 2017);

            Console.WriteLine("Month:");
            do
            {
                month = input.GetValidInt();
            } while (month < 0 || month > 12);

            Console.WriteLine("Day:");
            do
            {
                day = input.GetValidInt();
            } while (day < 0 || day > 31);

            furryMonster.DateOfBirth = new DateTime(year, month, day);

            Console.WriteLine("Enter monster type (Cat, Dog, Horse, Rat):");
            do
            {
                Console.Write(">");
                uInput = Console.ReadLine();
            } while (!Enum.TryParse <FurryMonsterType>(uInput, out monsterType));
            furryMonster.MonsterType = monsterType;

            furryMonsters.Add(furryMonster);

            Console.WriteLine();
            furryMonster.Greeting(furryMonster);

            display.DisplayAnyKey();
        }
예제 #4
0
        static void DisplayUserAddSeaMonsters(List <SeaMonster> seaMonsters, Generic_Display display)
        {
            Generic_Input  input = new Generic_Input();
            SeaMonsterType monsterType;
            string         uInput;
            int            year, month, day;

            display.DisplayNewScreen("Monster Maker");

            SeaMonster seaMonster = new SeaMonster();

            Console.WriteLine("Enter monster name:");
            seaMonster.Name = input.GetString(false);

            Console.WriteLine("Enter monster color:");
            seaMonster.Color = input.GetString(false);

            Console.WriteLine("Does monster have scales (true or false):");
            seaMonster.HasScales = input.GetBool();

            Console.WriteLine("Enter monster length in meters:");
            seaMonster.Length = input.GetValidInt();

            Console.WriteLine("When was the monster born.");
            Console.WriteLine("Year:");
            do
            {
                year = input.GetValidInt();
            } while (year < 0 || year > 2017);

            Console.WriteLine("Month:");
            do
            {
                month = input.GetValidInt();
            } while (month < 0 || month > 12);

            Console.WriteLine("Day:");
            do
            {
                day = input.GetValidInt();
            } while (day < 0 || day > 31);

            seaMonster.DateOfBirth = new DateTime(year, month, day);

            Console.WriteLine("Enter monster type (Fish, Cephalopod, Crustation, Jelly):");
            do
            {
                uInput = Console.ReadLine();
            } while (!Enum.TryParse <SeaMonsterType>(uInput, out monsterType));
            seaMonster.MonsterType = monsterType;

            seaMonsters.Add(seaMonster);

            Console.WriteLine();
            seaMonster.Greeting(seaMonster);

            display.DisplayAnyKey();
        }
예제 #5
0
        static void Main(string[] args)
        {
            List <VideoGame> inventory = new List <VideoGame>();
            Generic_Display  GD        = new Generic_Display();
            Generic_Input    GI        = new Generic_Input();

            inventory = InitializeVideoGameInventory();

            inventory.Add(DisplayGetGame(GI));

            DisplayInventory(inventory, GD);
        }
예제 #6
0
        static void Main(string[] args)
        {
            Generic_Display GD = new Generic_Display();
            Generic_Input   GI = new Generic_Input();
            Generic_Alter   GA = new Generic_Alter();

            GD.DisplayOpenScreen("Super Finch", "Tina the super finch will move forward until she is murdered by lazers and freeze rays.", new string[1] {
                "Eric Grant"
            });
            DisplayMainLoop(GD, GI, GA);
            GD.DisplayCloseScreen("Super Finch", new string[1] {
                "Eric Grant"
            });
        }
예제 #7
0
        /// <summary>
        /// display main program loop
        /// </summary>
        static void DisplayMainLoop(Generic_Display GD, Generic_Input GI, Generic_Alter GA)
        {
            //declare constants
            //
            int[,] NOSECOLORS = new int[4, 3] {
                { 0, 0, 0 }, { 255, 0, 0 }, { 0, 0, 255 }, { 0, 255, 0 }
            };
            int[] SPEEDS = new int[4] {
                0, 127, 191, 255
            };

            GD.DisplayNewScreen("Main App Loop");

            //instantiate SuperTina
            //
            Finch      superTina = InstantiateFinch();
            FinchLevel superTinaLevel;

            Console.WriteLine("\nPlease enter the shield level for Super Tina (1-3)");
            superTinaLevel = InputFinchLevelValid();
            Console.WriteLine($"\nSuper Tinas shields are at {superTinaLevel} power level");

            int[] SuperTinaNoseColor = new int[3];
            SuperTinaNoseColor = GA.SpliceIntMultiArray(NOSECOLORS, (int)superTinaLevel, 3);
            int SuperTinaSpeed = SPEEDS[(int)superTinaLevel];

            //declare variables
            //
            bool breakLoop = false;

            //activate SuperTina
            //
            Console.WriteLine("\nSuper Tina is ready for battle.");
            GD.DisplayAnyKey();

            superTina.setMotors(SuperTinaSpeed, SuperTinaSpeed);
            superTina.setLED(SuperTinaNoseColor[0], SuperTinaNoseColor[1], SuperTinaNoseColor[2]);

            //main loop
            //
            while (!breakLoop)
            {
                breakLoop = DisplayActivateTim(superTina, NOSECOLORS, SPEEDS, superTinaLevel, GD, GI, GA);
            }

            superTina.disConnect();
        }
예제 #8
0
        static bool DisplayActivateTim(Finch superTina, int[,] NOSECOLORS, int[] SPEEDS, FinchLevel superTinaLevel, Generic_Display GD, Generic_Input GI, Generic_Alter GA)
        {
            double currentTemp, currentLight, ambientTemp, ambientLight, min, max;

            int[] levelArray = new int[3];
            bool  breaking   = false;

            ambientTemp  = superTina.getTemperature();
            ambientLight = AverageLight(superTina);
            min          = ambientTemp - 1;
            max          = ambientLight + 3;

            Console.WriteLine($"Shields at {superTinaLevel} level.");

            while (!breaking)
            {
                currentTemp  = superTina.getTemperature();
                currentLight = AverageLight(superTina);
                superTina.wait(200);

                switch (superTinaLevel)
                {
                case FinchLevel.HIGH:
                    if (currentTemp < min && currentLight > max)     //freeze ray and lazer
                    {
                        superTinaLevel--;
                        superTina.setMotors(SPEEDS[(int)superTinaLevel], SPEEDS[(int)superTinaLevel]);
                        Hit(superTina, GA.SpliceIntMultiArray(NOSECOLORS, (int)superTinaLevel, 3));
                        Console.WriteLine($"Shield levels at {superTinaLevel}!\n");
                    }
                    break;

                case FinchLevel.MEDIUM:
                    if (currentLight > max)     //just lazer
                    {
                        superTinaLevel--;
                        superTina.setMotors(SPEEDS[(int)superTinaLevel], SPEEDS[(int)superTinaLevel]);
                        Hit(superTina, GA.SpliceIntMultiArray(NOSECOLORS, (int)superTinaLevel, 3));
                        Console.WriteLine($"Shield levels at {superTinaLevel}!\n");
                    }
                    break;

                case FinchLevel.LOW:
                    if (currentTemp < min)     //just freeze ray
                    {
                        superTinaLevel--;
                        superTina.setMotors(SPEEDS[(int)superTinaLevel], SPEEDS[(int)superTinaLevel]);
                        Hit(superTina, GA.SpliceIntMultiArray(NOSECOLORS, (int)superTinaLevel, 3));
                        Console.WriteLine($"Shield levels at {superTinaLevel}!\n");
                    }
                    else if (currentLight > max)     //just lazer
                    {
                        superTinaLevel--;
                        superTina.setMotors(SPEEDS[(int)superTinaLevel], SPEEDS[(int)superTinaLevel]);
                        Hit(superTina, GA.SpliceIntMultiArray(NOSECOLORS, (int)superTinaLevel, 3));
                        Console.WriteLine($"Shield levels at {superTinaLevel}!\n");
                    }
                    break;

                case FinchLevel.EMPTY:
                    breaking = true;
                    break;

                default:
                    break;
                }

                superTina.wait(200);
            }

            Console.WriteLine("SuperTina is dead. The world has been destroyed. All is lost, even hope.");

            GD.DisplayAnyKey();
            return(breaking);
        }