Example #1
0
    public void Load()
    {
        if (datas != null)
        {
            datas.Clear();
        }

        datas = ConfigManager.Load <CharacterConf>();
        dic.Clear();

        for (int i = 0; i < datas.Count; i++)
        {
            CharacterConf obj = datas[i];
            dic.Add(obj.id, obj);
            if (!dicByType.ContainsKey(obj.type))
            {
                List <CharacterConf> typelist = new List <CharacterConf>();
                typelist.Add(obj);
                dicByType.Add(obj.type, typelist);
            }
            else
            {
                dicByType[obj.type].Add(obj);
            }

            obj.SetPropertyvaluse();
        }
    }
Example #2
0
    public override void Init(int instanceId, int confid, enMSCamp camp)
    {
        base.Init(instanceId, confid, camp);

        propertys = new CharacterProperty();

        conf = ConfigManager.characterConfManager.dic[confid];

        //名字
        charactername = conf.name;

        //AI管理器
        actionManager = new BaseActionManager();
        actionManager.Init(this, Vector3.zero);

        //动画管理器
        anim = this.GetComponent <Animator>();

        //血条高度
        boxSize = transform.GetComponent <BoxCollider>().size *transform.localScale.x;

        //注册到UI界面
        //InGameManager.GetInstance().inGameUIManager.AddRole(this);

        this.level = conf.level;
        ResetAllProperty(true);

        lastPos = transform.position;

        EventManager.Register(this,
                              EventID.EVENT_GAME_CHARACTER_HURT);


        EventData.CreateEvent(EventID.EVENT_GAME_CHARACTER_BORN).AddData(this).Send();
    }
Example #3
0
    // Use this for initialization
    public void Init(CharacterConf conf)
    {
        this.conf = conf;

        nameLabel.text = conf.name;

        GameUIEventListener.Get(gameObject).onClick = ChooseSelf;
    }
Example #4
0
    public void LevelUp()
    {
        CharacterConf character = XMLData.CharacterConfs.Find(a => a.id == this.id);

        level++;
        speed     += character.levelSpeed;
        strength  += character.levelStrength;
        energy    += character.levelEnergy;
        totalBlood = totalBlood + character.levelBlood + (character.levelStrength * 20);
        blood      = totalBlood;
        CalculateArr();
    }
Example #5
0
 public void Init(CharacterConf conf)
 {
     nameLabel.text    = conf.name;
     sprite.spriteName = conf.id + "";
     num.text          = conf.strength + "";
     num1.text         = conf.speed + "";
     num2.text         = conf.energy + "";
     num3.text         = conf.blood + "";
     num4.text         = conf.levelStrength + "";
     num5.text         = conf.levelSpeed + "";
     num6.text         = conf.levelEnergy + "";
     num7.text         = conf.levelBlood + "";
 }
Example #6
0
 public void CreateItem(List <TalentConf> talents)
 {
     //Debug.LogError(talents.Count);
     foreach (TalentConf conf in talents)
     {
         CharacterConf character = XMLData.CharacterConfs.Find(a => a.id == int.Parse(conf.buff));
         GameObject    go        = NGUITools.AddChild(grid, item);
         go.GetComponent <RoleItem>().Init(character);
         UIEventListener.Get(go).onClick   = OnClickTalent;
         UIEventListener.Get(go).parameter = character.id;
         go.SetActive(true);
     }
     grid.GetComponent <UIGrid>().Reposition();
 }
Example #7
0
    public InGameBaseObj AddObj(int objid, enMSCamp camp)
    {
        gameObjInstanceId++;

        CharacterConf conf = ConfigManager.characterConfManager.dic[objid];
        GameObject    obj  = Resources.Load(conf.prefabName) as GameObject;

        obj = MonoBehaviour.Instantiate(obj);

        InGameBaseObj objscript = obj.GetComponent <InGameBaseObj>();

        objscript.Init(gameObjInstanceId, objid, camp);
        addList.Add(objscript);
        return(objscript);
    }
Example #8
0
 public void Create(int level, CharacterConf character)
 {
     IsNPC      = true;
     this.id    = character.id;
     this.level = level;
     speed      = character.speed + ((level - 1) * character.levelSpeed);
     strength   = character.strength + ((level - 1) * character.levelStrength);
     energy     = character.energy + ((level - 1) * character.levelEnergy);
     blood      = character.blood + ((level - 1) * character.levelBlood) + (strength * 20);
     totalBlood = blood;
     moves      = speed / 5;
     roundGas   = energy / 5;
     gas        = roundGas;
     totalGas   = roundGas * 2;
     skillConf  = XMLData.SkillConfigs.Find(a => a.id == character.skill);
     skillLevel = XMLData.SkillLevelConfs.Find(a => a.id == character.skill);
 }
Example #9
0
    public void Create(CharacterConf character)
    {
        IsNPC      = false;
        this.id    = character.id;
        this.level = 1;
        speed      = character.speed;
        strength   = character.strength;
        energy     = character.energy;
        blood      = character.blood + (strength * 20);
        totalBlood = blood;
        moves      = (speed / 5);
        roundGas   = energy / 5;
        roundMove  = moves;
        totalGas   = roundGas * 2;
        gas        = totalGas;
        Skill skill = new Skill(character.skill, 1);

        GameManage.Instance.userData.skills.Add(skill);
    }
Example #10
0
    //配置表id
    public InGameBaseObj ShowBaseRole(int id)
    {
        if (chooseRole != null)
        {
            MonoBehaviour.Destroy(chooseRole);
            chooseRole = null;
        }

        CharacterConf conf = ConfigManager.characterConfManager.dic[id];

        Debug.Log(conf.prefabName);
        GameObject obj = Resources.Load(conf.prefabName) as GameObject;

        obj = MonoBehaviour.Instantiate(obj);
        obj.transform.position = Vector3.zero;

        InGameBaseObj objscript = obj.GetComponent <InGameBaseObj>();

        chooseRole = obj;
        return(objscript);
    }