예제 #1
0
        static void Main(string[] args)
        {
            Hokemon hokeObject01 = new Hokemon();

            Console.WriteLine("\nHokemon name is: {0}", hokeObject01.Name);

            hokeObject01.get_details();

            Hokemon hokeObject02 = new Hokemon();

            Console.WriteLine("\nHokemon name is: {0}", hokeObject02.Name);

            hokeObject02.get_details();

            // Using the about method
            hokeObject01.about();

            Battle_Arena firstArena = new Battle_Arena(); // Instantiated Battle_Arena

            firstArena.ChallengeMe(hokeObject01);
            firstArena.ChallengeAccepted(hokeObject02);
            firstArena.Battle(hokeObject01, hokeObject02);

            // Declaring members
            Hinstinct[] ChallengerArray = new Hinstinct[3];

            Random rnd        = new Random();
            bool   repeatGame = true;
            string result;

            // Creating player Hokemon
            Halor playerHokemon01 = new Halor(); // Instantiation from Halor class

            // NPC Hokemon
            for (int i = 0; i < ChallengerArray.Length; i++)
            {
                ChallengerArray[i] = new Hinstinct(); // Instatiating challenger Hokemon
            }

            while (repeatGame == true)
            {
                playerHokemon01.about();
                firstArena.ChallengeMe(playerHokemon01);
                firstArena.Battle(playerHokemon01, ChallengerArray[rnd.Next(0, ChallengerArray.Length)]);

                Console.WriteLine("\nDo you want to repeat the game? (y/n)");
                result = Console.ReadLine();
                if (result.ToLower()[0] == 'n')
                {
                    repeatGame = false;
                }
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Console.WriteLine("Hello to Hokeworld!");

            Hokemon hokeObject01 = new Hokemon(); // INSTANTIATION of object hokeObject01

            //Console.WriteLine("Hokemon name is: {0}", hokeObject01.Name);

            hokeObject01.get_details();

            Hokemon hoke02 = new Hokemon();  // INSTANTIATION of object 2

            //Console.WriteLine("Hokemon name is: {0}", hokeObject01.Name);

            Console.WriteLine("Name of Hokemon: {0}", hoke02.Name);
            Console.WriteLine("***********");
            Console.WriteLine("****Details below***");
            hoke02.get_details();

            Hokemon hoke03 = new Hokemon();  // INSTANTIATION of object 2

            //Console.WriteLine("Hokemon name is: {0}", hokeObject01.Name);

            hoke03.get_details();

            Battle_Arena firstArena = new Battle_Arena(); // INSTANTIATED Battle_Arena

            firstArena.ChallengeMe(hokeObject01);

            firstArena.ChallengeAccepted(hokeObject01, hoke03); // Passing two objects into
                                                                // the firstArena
            Hokemon hoke04 = new Hokemon();                     //INSTANTIATION from Hokeon Class

            Halor haloHokemon01 = new Halor();                  //INSTANTIATION from Hokeon Class

            haloHokemon01.get_details();

            //Demonstrating POLYMORPHISM with about method
            //a Hokemon instance hoke02
            //a halor instance haloHokemon01

            hoke02.about();
            haloHokemon01.about()

            /*
             *          Battle_Arena firstArena = new Battle_Arena(); // INSTANTUATED Battle_Arena
             */
        }