Esempio n. 1
0
        public static IUnit Create(UnitType type, string name, int x, int y)
        {
            switch (type)
            {
            case UnitType.Warrior:
                Warrior        warrior = new Warrior(name, x, y);
                ICombatHandler warriorCombatHandler = new WarriorCombatHandler(warrior);

                warrior.CombatHandler = warriorCombatHandler;

                return(warrior);

            case UnitType.Mage:
                Mage           mage = new Mage(name, x, y);
                ICombatHandler mageCombatHandler = new MageCombatHandler(mage);

                mage.CombatHandler = mageCombatHandler;

                return(mage);

            case UnitType.IceGiant:
                IceGiant       iceGiant = new IceGiant(name, x, y);
                ICombatHandler iceGiantCombatHandler = new IceGiantCombatHandler(iceGiant);

                iceGiant.CombatHandler = iceGiantCombatHandler;

                return(iceGiant);

            default:
                throw new NotImplementedException();
            }
        }
Esempio n. 2
0
 public static IUnit Create(UnitType type, string name, int x, int y)
 {
     switch (type)
     {
         case UnitType.Warrior:
             var warrior = new Warrior(x, y, name);
             return warrior;
         case UnitType.IceGiant:
             var iceGiant = new IceGiant(x, y, name);
             return iceGiant;
         case UnitType.Mage:
             var mage = new Mage(x, y, name);
             return mage;
         default:
             throw new NotImplementedException();
     }
 }
Esempio n. 3
0
        public static IUnit Create(UnitType type, string name, int x, int y)
        {
            switch (type)
            {
            case UnitType.Warrior:
                var warrior = new Warrior(x, y, name);
                return(warrior);

            case UnitType.IceGiant:
                var iceGiant = new IceGiant(x, y, name);
                return(iceGiant);

            case UnitType.Mage:
                var mage = new Mage(x, y, name);
                return(mage);

            default:
                throw new NotImplementedException();
            }
        }