Пример #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");
        }
Пример #2
0
    public void CastSpell(int chosenSpell)
    {
        switch (chosenSpell)
        {
        case (int)SPELLS.Movement:
            Debug.Log("Movement");
            break;

        case (int)SPELLS.Fireball:
            if (fireball.Cast())
            {
                ClearStatus();
            }
            else
            {
                gui.SetCursorStatus("On Cooldown!");
            }
            ClearStatus();
            break;

        case (int)SPELLS.Fireblast:
            if (fireblast.Cast())
            {
                ClearStatus();
            }
            else
            {
                gui.SetCursorStatus("On Cooldown!");
                ClearStatus();
            }
            break;


        case (int)SPELLS.Teleport:
            if (teleport.Cast())
            {
                ClearStatus();
            }
            else
            {
                gui.SetCursorStatus("On Cooldown!");
                ClearStatus();
            }
            break;

        case (int)SPELLS.Windblast:
            if (windblast.Cast())
            {
                ClearStatus();
            }
            else
            {
                gui.SetCursorStatus("On Cooldown!");
                ClearStatus();
            }
            break;
        }
    }