Ejemplo n.º 1
0
        public Hero(string name, HeroSexEnum sex, HeroClassEnum @class, bool hasBook, params SecondarySkillWithLevel[] skills)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            Name    = name;
            Sex     = sex;
            Class   = @class;
            HasBook = hasBook;
            Skills  = skills ?? new SecondarySkillWithLevel[0];
        }
Ejemplo n.º 2
0
    public Hero Create(Hero heroPrefab, Transform spawnPlace, HeroClassEnum heroClass)
    {
        // Create hero and set position and parent for him
        var heroInstance = Instantiate(heroPrefab, HeroParentTransform);

        heroInstance.transform.position = spawnPlace.transform.position;

        // Set class for hero
        ClassSetter.SetClassToHero(heroInstance, _heroClassGetter.GetClassConfig(heroClass));

        // Create Hp view for hero
        _hpHpCreator.Create(HpShowerPrefab, HeroParentTransform, heroInstance.GetLiveble());

        return(heroInstance);
    }
Ejemplo n.º 3
0
 public HeroClassConfig GetClassConfig(HeroClassEnum heroClass)
 {
     return(_heroClassDictionary[heroClass]);
 }