예제 #1
0
        public static void RunTests()
        {
            Console.WriteLine("Base Ability: ");
            Ability normal = new Ability();

            normal.Activate();

            Console.WriteLine("\n\nDerived Ability: ");
            Ability openChest = new Open("Open Chest.");

            openChest.Activate();


            Console.WriteLine("\n\nInterface Spell: ");
            Fireball fireball = new Fireball(3.5f, (d) => { Console.WriteLine("Burn..."); });

            Console.WriteLine("-----------");
            fireball.Cast();

            Console.WriteLine("\n\nUsing both Interface & Inheritance: ");
            SuperAbility myUlt = new SuperAbility("Lord of Vermillion", (cool) =>
            {
                Console.WriteLine("Lightning crashes down from the heavens, the caster needs to rest for " + cool + "seconds");
            });

            myUlt.SetCooldown(6);
            myUlt.Cast();

            Console.WriteLine("\n\nEnd of Inheritance/Interface Examples");
        }