Esempio n. 1
0
    /// <summary>
    ///  将所有数据添加进字典中
    /// </summary>
    private void addSoldierData( int soldierId, bool isMe)
    {
        SoldiersCollocationAgent soldiers = new SoldiersCollocationAgent();

        soldiers.setData(soldierId);

        // 对应的兵种ID
        int[] soldierIdArray = soldiers.getSoldies();

        for (int i = 0; i < soldierIdArray.Length; ++i)
        {
            if (soldierIdArray[i] != 0)
            {
                SoldierDataBase soldier = new SoldierDataBase();
                soldier.Sid = soldierIdArray[i];

                setSoldierData(soldier);

                SoldiersDict.Add(i, soldier);
            }
            else // 占位用
            {
                SoldiersDict.Add(i, null);
            }
        }
    }
Esempio n. 2
0
    /// <summary>
    /// 设置数据
    /// </summary>
    //private void setSoldierHeroData(SoldierDataBase _heroSoldier)
    private void setSoldierData(SoldierDataBase heroSoldier)
    {
        // 相关的类型转换
        _monster = _isMe == true ? _monster : ((MonsterAgent)_monster);

        // 设置对应的数据
        _monster.setData(heroSoldier.Sid);

        // 设置英雄数据
        heroSoldier.Sid                          = _monster.getID() ;

        heroSoldier.Model                        = _monster.getModel();

        heroSoldier.HP                           =  _monster.getHP() ;

        // TODO
        if (heroSoldier.HP<=0)
        {
            int a=0;
        }

        heroSoldier.RoleID                       = _monster.getRoleID();

        heroSoldier.RoleName                     = _monster.getRoleName();

        heroSoldier.PhysicalStrength             =  _monster.getPhysicalStrength();

        heroSoldier.PhysicalNormal               =  _monster.getPhysicalNormal();

        heroSoldier.SpellIntensity               =  _monster.getSpellIntensity();

        heroSoldier.SpellOrdinary                =  _monster.getSpellOrdinary() ;

        heroSoldier.Crit                         =  _monster.getCrit();

        heroSoldier.CritCoefficient              =  _monster.getCritCoefficient();

        heroSoldier.Violence                     =  _monster.getViolence() ;

        heroSoldier.ViolenceCoefficient          =  _monster.getViolenceCoefficient();

        heroSoldier.PhysicalDefense              =  _monster.getPhysicalDefense();

        heroSoldier.Physical                     =  _monster.getPhysical();

        heroSoldier.Things                       =  _monster.getThings();

        heroSoldier.SpellDefense                 =  _monster.getSpellDefense();

        heroSoldier.Spell                        =  _monster.getSpell();

        heroSoldier.SpellCoefficient             =  _monster.getSpellCoefficient();

        heroSoldier.Dodge                        =  _monster.getDodge();

        heroSoldier.DodgeCoefficient             = _monster.getDodgeCoefficient();

        heroSoldier.Interval                     =  _monster.getInterval();

        heroSoldier.MoveSpeed                    =  _monster.getSpeed();

        heroSoldier.AttckDistance                =   _monster.getAttackDistance();

        heroSoldier.Skills                       = _monster.getSkills();

        heroSoldier.InitialMP                    = _monster.getInitialMP();

        // 目前没啥用  从 兵种结构那里可以获取
        heroSoldier.CarryMosterNumber            = _monster.getCarrayMosterNumber();  // 佣兵数量

        heroSoldier.HavaMosterID                 = _monster.getMercenary(); // 如果是英雄那么他将拥有兵种ID

        if (_isMe == true) // 自己的英雄数据
        {

            heroSoldier.WorldName      = _monster.getWorldName();

            heroSoldier.RoleType       = _monster.getRoleType();

            heroSoldier.RoleProduct    = _monster.getRoleProduct();

            heroSoldier.ProductParam   = _monster.getProductParam();

            heroSoldier.HPGrowth       = _monster.getHPGrowth();

            heroSoldier.PhysicalGrowth = _monster.getPhysicalGrowth();

            heroSoldier.SpellGrowth    = _monster.getSpellGrowth();

            heroSoldier.DefGrowth      = _monster.getDefGrowth();

            heroSoldier.SdefGrowth     = _monster.getSdefGrowth();

            heroSoldier.MPGrowth       = _monster.getMpGrowth();
        }
        else  // 敌方
        {
            heroSoldier.Level                 = ((MonsterAgent)_monster).getLevel();

            heroSoldier.DodgeIntensity        = ((MonsterAgent)_monster).getDodgeIntensity();

            heroSoldier.Bonus                 = ((MonsterAgent)_monster).getBonus();

            heroSoldier.Combat                = ((MonsterAgent)_monster).getCombat();

            heroSoldier.Drop                  = ((MonsterAgent)_monster).getDrop();

            heroSoldier.ViolenceIntensity     = ((MonsterAgent)_monster).getViolenceIntensity();

            heroSoldier.CritIntensity         = ((MonsterAgent)_monster).getCritIntensity();
        }

        heroSoldier.ATK = Formula.Formula.getNakedAttribute(heroSoldier.PhysicalStrength, _isMe == true ? heroSoldier.PhysicalGrowth : 0, 0);

        heroSoldier.SATK = Formula.Formula.getNakedAttribute(heroSoldier.SpellIntensity,  _isMe == true ? heroSoldier.SpellGrowth : 0, 0);
    }
Esempio n. 3
0
    /// <summary>
    /// 添加一个士兵——————测试用
    /// </summary>
    /// <param name="country"></param>
    /// <param name="x_"></param>
    /// <param name="y_"></param>
    public void addSoldier(SoldierDataBase data, Defaults.SoldierType soldierType, Vector3 point)
    {
        //复制预制件
        GameObject soldierBody = ResourceManager.getInstance().getGameObject(ResourceConfig.getPrefabName(soldierType));
        soldierBody.name = null;

        if (data == null)
        {
            return;
        }

        if (data.Country == Defaults.Country.Me)
        {
            soldierBody.name = "me" + sprId;
        }
        else
        {
            soldierBody.name = "enemy" + sprId;
        }
        sprId++;

        //如果取得预制件失败,返回
        if(soldierBody == null)
        {
            return;
        }

        //根据兵种实例化兵种类,绑定到预制件
        Type scriptType = ResourceConfig.getClassType(soldierType);
        soldierBody.AddComponent(scriptType);
        GeneralSoldier soldierScript = soldierBody.GetComponent(scriptType) as GeneralSoldier;
        //如果取得脚本失败,返回
        if (soldierScript == null)
        {
            return;
        }

        //设置属性
        soldierScript._data = data;//势力
        soldierScript._data.DeadDelay = 10;
        soldierScript._data.SkillMgr.setSkills(soldierScript);//技能
        int distance = data.Country == Defaults.Country.Me ? 14 : 26;//敌我距离
        soldierBody.transform.Rotate(0, data.Country == Defaults.Country.Me ? 0 : 180, 0);//设置敌我部队的朝向
        soldierBody.transform.position = point;//设置坐标

        //存进士兵容器
        if (data.Country == Defaults.Country.Enemy)
        {
            _enemySoldiers.Add(soldierScript);
        }
        else
        {
            _selfSoldiers.Add(soldierScript);
        }
    }