Exemple #1
0
    public void setData(HeroConfig cfg, int id,
                        int level, int exp, SkillMgr skillMgr)
    {
//		_cfg = cfg;

        _configId = Convert.ToInt32(cfg.id);
        _id       = id;
        _exp      = exp;

        _start   = Convert.ToInt32(cfg.star);
        _bodyImg = "body/body" + _configId;
        _name    = (string)cfg.name;

        _atkBase   = Convert.ToInt32(cfg.atkBase);
        _atkParama = Convert.ToInt32(cfg.atkParam);

        _hpBase   = Convert.ToInt32(cfg.hpBase);
        _hpParama = Convert.ToInt32(cfg.hpParam);

        _spdBase   = Convert.ToInt32(cfg.spdBase);
        _spdParama = Convert.ToInt32(cfg.spdParam);

        _heroSkillModels = new List <HeroSkillModel> ();
        int[] skillInfo = cfg.skillInfo;        //[level,skillId]
        for (int i = 0; i < skillInfo.Length; i = i + 2)
        {
            int needLevel = Convert.ToInt32(skillInfo[i]);
            int skillId   = Convert.ToInt32(skillInfo[i + 1]);

            SkillModel     skillModel = skillMgr.getSkillModel(skillId);
            HeroSkillModel hsModel    = new HeroSkillModel();
            hsModel.setSkillModel(skillModel, needLevel);

            _heroSkillModels.Add(hsModel);
        }

        setLevel(level);
    }