예제 #1
0
        public CHeroBase GetHero(EHeroTypes type)
        {
            CHeroFactory heroFactory = null;

            switch (type)
            {
            case EHeroTypes.Paladin:
                heroFactory = new CPaladinFactory();
                break;

            case EHeroTypes.Mage:
                heroFactory = new CMageFactory();
                break;

            case EHeroTypes.Thief:
                heroFactory = new CThiefFactory();
                break;

            case EHeroTypes.Warrior:
                heroFactory = new CWarriorFactory();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }

            return(heroFactory.CreateHero());
        }
예제 #2
0
 private CHeroData(String name, EHeroTypes type, Int32 healthPoints, Int32 movingEnergy, String description)
 {
     Name         = name;
     Type         = type;
     HealthPoints = healthPoints;
     MovingEnergy = movingEnergy;
     Description  = description;
 }
예제 #3
0
 public static CHeroData Create(String name, EHeroTypes type,
                                Int32 healthPoints, Int32 movingEnergy, String description)
 {
     return(new CHeroData(name, type, healthPoints, movingEnergy, description));
 }
예제 #4
0
        public CHeroData GetHero(EHeroTypes type)
        {
            CHeroDto heroDto = _heroesRepository.GetByType((Int32)type);

            return(MapHeroDataFromDto(heroDto));
        }
예제 #5
0
        public CHeroData GetHeroByType(EHeroTypes type)
        {
            CHeroesProvider provider = CHeroesProvider.Create();

            return(provider.GetHero(type));
        }