Пример #1
0
        public static IUnit Create(UnitType type, string name, int x, int y, IEnumerable<IUnit> targets )
        {
            IUnit character;
            switch (type)
            {
                case UnitType.Warrior:
                    character = new Warrior(x, y, name, new WarriorCombatHandler(targets));
                    character.CombatHandler.Unit = character;
                    break;
                    case UnitType.Mage:
                    character = new Mage(x, y, name, new MageCombatHandler(targets));
                    character.CombatHandler.Unit = character;
                    break;
                    case UnitType.IceGiant:
                    character = new IceGiant(x, y, name, new IceGiantCombatHandler(targets));
                    character.CombatHandler.Unit = character;
                    break;
                default:
                    throw new GameException("There is no such unit");

            }

            return character;
        }
 public MageCombatHandler(Mage mage)
 {
     this.Unit = mage;
 }