Пример #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;
        }
Пример #2
0
 public IceGiantCombatHandler(IceGiant giantUnit)
 {
     this.Unit = giantUnit;
 }
 public IceGiantCombatHandler(IceGiant iceGiant)
 {
     this.Unit = iceGiant;
 }