Beispiel #1
0
        public void LoadData(int resId)
        {
            SetLinkId(resId);
            m_LevelupConfig = NpcConfigProvider.Instance.GetNpcLevelupConfigById(resId);
            Data_NpcConfig npcCfg = NpcConfigProvider.Instance.GetNpcConfigById(resId);

            if (null != npcCfg)
            {
                m_NpcType = npcCfg.m_NpcType;
                switch (m_NpcType)
                {
                case (int)NpcTypeEnum.Mecha:
                    m_IsMecha = true;
                    break;

                case (int)NpcTypeEnum.Horse:
                    m_IsHorse = true;
                    break;

                case (int)NpcTypeEnum.Task:
                    m_IsTask = true;
                    break;

                case (int)NpcTypeEnum.PvpTower:
                    m_IsPvpTower = true;
                    break;
                }
                m_IsRangeNpc        = npcCfg.m_IsRange;
                m_IsShine           = npcCfg.m_IsShine;
                m_CanMove           = npcCfg.m_CanMove;
                m_CanRotate         = npcCfg.m_CanRotate;
                m_DeadType          = (NpcDeadType)npcCfg.m_DeadType;
                m_DropCount         = npcCfg.m_DropCount;
                m_DropExp           = npcCfg.m_DropExp;
                m_DropMoney         = npcCfg.m_DropMoney;
                m_DropProbabilities = npcCfg.m_DropProbabilities;
                m_DropNpcs          = npcCfg.m_DropNpcs;
                m_Scale             = npcCfg.m_Scale;

                m_IsHurtComa        = npcCfg.m_IsHurtComa;
                m_isBlaze           = npcCfg.m_isBlaze;
                m_BornAnimTimeMs    = npcCfg.m_BornTimeMs;
                m_BornEffect        = npcCfg.m_BornEffect;
                m_IsAttachControler = npcCfg.m_IsAttachControler;
                m_AttachNodeName    = npcCfg.m_AttachNodeName;
                m_MuzzlePos         = npcCfg.m_GunEndRelativePos;
                m_SecondMuzzlePos   = npcCfg.m_GunEndRelativePos;
                m_SecondMuzzlePos.X = -npcCfg.m_GunEndRelativePos.X;

                SetName(npcCfg.m_Name);
                SetLevel(npcCfg.m_Level);
                SetModel(npcCfg.m_Model);
                DeathModel  = npcCfg.m_DeathModel;
                DeathEffect = npcCfg.m_DeathEffect;
                DeathSound  = npcCfg.m_DeathSound;
                SetActionList(npcCfg.m_ActionList);
                SetBarrageId(npcCfg.m_Barrage);

                AvoidanceRadius = npcCfg.m_AvoidanceRadius;
                if (null != npcCfg.m_Shape)
                {
                    Shape = (Shape)npcCfg.m_Shape.Clone();
                }
                else
                {
                    Shape = new Circle(new Vector3(0, 0, 0), 1);
                }

                ViewRange   = npcCfg.m_ViewRange;
                GohomeRange = npcCfg.m_GohomeRange;
                ReleaseTime = npcCfg.m_ReleaseTime;
                HeadUiPos   = npcCfg.m_HeadUiPos;

                int   hp                = (int)npcCfg.m_AttrData.GetAddHpMax(0, npcCfg.m_Level);
                int   energy            = (int)npcCfg.m_AttrData.GetAddNpMax(0, npcCfg.m_Level);
                float moveSpeed         = npcCfg.m_AttrData.GetAddSpd(0, npcCfg.m_Level);
                int   hpMax             = (int)npcCfg.m_AttrData.GetAddHpMax(0, npcCfg.m_Level);
                int   energyMax         = (int)npcCfg.m_AttrData.GetAddNpMax(0, npcCfg.m_Level);
                int   energyCoreMax     = (int)npcCfg.m_AttrData.GetAddEpMax(0, npcCfg.m_Level);
                int   crgMax            = (int)npcCfg.m_AttrData.GetAddCrgMax(0, npcCfg.m_Level);
                float hpRecover         = npcCfg.m_AttrData.GetAddHpRecover(0, npcCfg.m_Level);
                float energyRecover     = npcCfg.m_AttrData.GetAddNpRecover(0, npcCfg.m_Level);
                float energyCoreRecover = npcCfg.m_AttrData.GetAddEpRecover(0, npcCfg.m_Level);
                int   attackBase        = (int)npcCfg.m_AttrData.GetAddAd(0, npcCfg.m_Level);
                int   defenceBase       = (int)npcCfg.m_AttrData.GetAddDp(0, npcCfg.m_Level);
                float critical          = npcCfg.m_AttrData.GetAddCri(0, npcCfg.m_Level);
                float criticalPow       = npcCfg.m_AttrData.GetAddPow(0, npcCfg.m_Level);
                float armorPenetration  = npcCfg.m_AttrData.GetAddAndp(0, npcCfg.m_Level);
                float energyIntensity   = npcCfg.m_AttrData.GetAddAp(0, npcCfg.m_Level);
                float energyArmor       = npcCfg.m_AttrData.GetAddTay(0, npcCfg.m_Level);
                float attackRange       = npcCfg.m_AttrData.GetAddRange(0, npcCfg.m_Level);
                float aRps              = npcCfg.m_AttrData.GetAddRps(0, npcCfg.m_Level);
                int   aCrg              = (int)npcCfg.m_AttrData.GetAddCrg(0, npcCfg.m_Level);
                float aCht              = npcCfg.m_AttrData.GetAddCht(0, npcCfg.m_Level);
                float aWdps             = npcCfg.m_AttrData.GetAddDps(0, npcCfg.m_Level);
                float aDamRandom        = npcCfg.m_AttrData.GetAddDamRange(0, npcCfg.m_Level);

                GetBaseProperty().SetMoveSpeed(Operate_Type.OT_Absolute, moveSpeed);
                GetBaseProperty().SetHpMax(Operate_Type.OT_Absolute, hpMax);
                GetBaseProperty().SetEnergyMax(Operate_Type.OT_Absolute, energyMax);
                GetBaseProperty().SetEnergyCoreMax(Operate_Type.OT_Absolute, energyCoreMax);
                GetBaseProperty().SetCrgMax(Operate_Type.OT_Absolute, crgMax);
                GetBaseProperty().SetHpRecover(Operate_Type.OT_Absolute, hpRecover);
                GetBaseProperty().SetEnergyRecover(Operate_Type.OT_Absolute, energyRecover);
                GetBaseProperty().SetEnergyCoreRecover(Operate_Type.OT_Absolute, energyCoreRecover);
                GetBaseProperty().SetAttackBase(Operate_Type.OT_Absolute, attackBase);
                GetBaseProperty().SetDefenceBase(Operate_Type.OT_Absolute, defenceBase);
                GetBaseProperty().SetCritical(Operate_Type.OT_Absolute, critical);
                GetBaseProperty().SetCriticalPow(Operate_Type.OT_Absolute, criticalPow);
                GetBaseProperty().SetArmorPenetration(Operate_Type.OT_Absolute, armorPenetration);
                GetBaseProperty().SetEnergyIntensity(Operate_Type.OT_Absolute, energyIntensity);
                GetBaseProperty().SetEnergyArmor(Operate_Type.OT_Absolute, energyArmor);
                GetBaseProperty().SetAttackRange(Operate_Type.OT_Absolute, attackRange);
                GetBaseProperty().SetRps(Operate_Type.OT_Absolute, aRps);
                GetBaseProperty().SetCrg(Operate_Type.OT_Absolute, aCrg);
                GetBaseProperty().SetCht(Operate_Type.OT_Absolute, aCht);
                GetBaseProperty().SetWdps(Operate_Type.OT_Absolute, aWdps);
                GetBaseProperty().SetDamRange(Operate_Type.OT_Absolute, aDamRandom);

                // 技能数据
                for (int i = 0; i < npcCfg.m_SkillList.Count; i++)
                {
                    SkillInfo skillInfo = new SkillInfo(npcCfg.m_SkillList[i]);
                    GetSkillStateInfo().AddSkill(skillInfo);
                }

                for (int i = 0; i < npcCfg.m_WeaponList.Count; ++i)
                {
                    WeaponInfo      weaponInfo = new WeaponInfo(npcCfg.m_WeaponList[i]);
                    WeaponLogicData weaponData = weaponInfo.ConfigData;
                    if (null != weaponData)
                    {
                        GetShootStateInfo().AddWeapon(0, weaponInfo);
                        if (null == GetShootStateInfo().GetCurWeaponInfo())
                        {
                            GetShootStateInfo().SetCurWeaponInfo(weaponInfo.WeaponId);
                            GetShootStateInfo().CurrentWeaponIndex = i;
                        }
                        //todo:先按武器表里的武器配置上,后续需要从db里读取升级数据并初始化升级配置数据
                        EquipmentDataInfo equipDataInfo = new EquipmentDataInfo();
                        equipDataInfo.EquipmentConfig = EquipmentConfigProvider.Instance.GetEquipmentConfigById(weaponData.m_EquipmentId);
                        GetEquipmentStateInfo().EquipmentInfo.Weapons[i] = equipDataInfo;
                    }
                }

                NpcAttrCalculator.Calc(this);
                CalcValidDropNumAndTotalDropProbability();
                SetHp(Operate_Type.OT_Absolute, GetActualProperty().HpMax);
                SetEnergy(Operate_Type.OT_Absolute, GetActualProperty().EnergyMax);
                for (int i = 0; i < npcCfg.m_WeaponList.Count; ++i)
                {
                    WeaponInfo      weaponInfo = GetShootStateInfo().GetWeaponInfoById(npcCfg.m_WeaponList[i]);
                    WeaponLogicData weaponData = weaponInfo.ConfigData;
                    if (null != weaponData)
                    {
                        //暴击数值
                        float CRIRATE_   = (float)(GetActualProperty().Critical / 480.0);
                        float CRIRATE_C_ = CriticalConfigProvider.Instance.GetC(CRIRATE_);
                        weaponInfo.CurCritical = CRIRATE_C_;
                    }
                }
            }
        }
Beispiel #2
0
        public void LoadData(int resId)
        {
            SetLinkId(resId);
            m_LevelupConfig = PlayerConfigProvider.Instance.GetPlayerLevelupConfigById(resId);
            Data_PlayerConfig playerData = PlayerConfigProvider.Instance.GetPlayerConfigById(resId);

            if (null != playerData)
            {
                SetName(playerData.m_Name);
                SetModel(playerData.m_Model);
                SetActionList(playerData.m_ActionList);

                m_AiEquipment      = playerData.m_AiEquipment;
                m_AiAttackSkill    = playerData.m_AiAttackSkill;
                m_AiMoveSkill      = playerData.m_AiMoveSkill;
                m_AiControlSkill   = playerData.m_AiControlSkill;
                m_AiSelfAssitSkill = playerData.m_AiSelfAssitSkill;
                m_AiTeamAssitSkill = playerData.m_AiTeamAssitSkill;
                ///
                GetAiStateInfo().AiLogic = playerData.m_AiLogic;

                m_Scale         = playerData.m_Scale;
                AvoidanceRadius = playerData.m_AvoidanceRadius;
                Shape           = new Circle(new Vector3(0, 0, 0), playerData.m_Radius);

                ViewRange           = playerData.m_ViewRange;
                ReleaseTime         = playerData.m_ReleaseTime;
                HeadUiPos           = playerData.m_HeadUiPos;
                CostType            = playerData.m_CostType;
                ShootBuffLifeTime   = playerData.m_ShootBuffLifeTime;
                NoGunRunEnterTimeMs = playerData.m_NoGunRunEnterTimeMs;

                int   hp                = (int)playerData.m_AttrData.GetAddHpMax(0, 0);
                int   energy            = (int)playerData.m_AttrData.GetAddNpMax(0, 0);
                int   energyCore        = (int)playerData.m_AttrData.GetAddEpMax(0, 0);
                float moveSpeed         = playerData.m_AttrData.GetAddSpd(0, 0);
                int   hpMax             = (int)playerData.m_AttrData.GetAddHpMax(0, 0);
                int   energyMax         = (int)playerData.m_AttrData.GetAddNpMax(0, 0);
                int   energyCoreMax     = (int)playerData.m_AttrData.GetAddEpMax(0, 0);
                int   crgMax            = (int)playerData.m_AttrData.GetAddCrgMax(0, 0);
                float hpRecover         = playerData.m_AttrData.GetAddHpRecover(0, 0);
                float energyRecover     = playerData.m_AttrData.GetAddNpRecover(0, 0);
                float energyCoreRecover = playerData.m_AttrData.GetAddEpRecover(0, 0);
                int   attackBase        = (int)playerData.m_AttrData.GetAddAd(0, 0);
                int   defenceBase       = (int)playerData.m_AttrData.GetAddDp(0, 0);
                float critical          = playerData.m_AttrData.GetAddCri(0, 0);
                float criticalPow       = playerData.m_AttrData.GetAddPow(0, 0);
                float armorPenetration  = playerData.m_AttrData.GetAddAndp(0, 0);
                float energyIntensity   = playerData.m_AttrData.GetAddAp(0, 0);
                float energyArmor       = playerData.m_AttrData.GetAddTay(0, 0);
                float attackRange       = playerData.m_AttrData.GetAddRange(0, 0);

                m_MuzzlePos = playerData.m_GunEndRelativePos;

                GetBaseProperty().SetMoveSpeed(Operate_Type.OT_Absolute, moveSpeed);
                GetBaseProperty().SetHpMax(Operate_Type.OT_Absolute, hpMax);
                GetBaseProperty().SetRageMax(Operate_Type.OT_Absolute, (int)playerData.m_AttrData.GetAddRageMax(0, 0));
                GetBaseProperty().SetEnergyMax(Operate_Type.OT_Absolute, energyMax);
                GetBaseProperty().SetEnergyCoreMax(Operate_Type.OT_Absolute, energyCoreMax);
                GetBaseProperty().SetCrgMax(Operate_Type.OT_Absolute, crgMax);
                GetBaseProperty().SetHpRecover(Operate_Type.OT_Absolute, hpRecover);
                GetBaseProperty().SetEnergyRecover(Operate_Type.OT_Absolute, energyRecover);
                GetBaseProperty().SetEnergyCoreRecover(Operate_Type.OT_Absolute, energyCoreRecover);
                GetBaseProperty().SetAttackBase(Operate_Type.OT_Absolute, attackBase);
                GetBaseProperty().SetDefenceBase(Operate_Type.OT_Absolute, defenceBase);
                GetBaseProperty().SetCritical(Operate_Type.OT_Absolute, critical);
                GetBaseProperty().SetCriticalPow(Operate_Type.OT_Absolute, criticalPow);
                GetBaseProperty().SetArmorPenetration(Operate_Type.OT_Absolute, armorPenetration);
                GetBaseProperty().SetEnergyIntensity(Operate_Type.OT_Absolute, energyIntensity);
                GetBaseProperty().SetEnergyArmor(Operate_Type.OT_Absolute, energyArmor);
                GetBaseProperty().SetAttackRange(Operate_Type.OT_Absolute, attackRange);

                // 技能数据
                for (int i = 0; i < 4; i++)
                {
                    GetSkillStateInfo().AddSkill(i, new SkillInfo(i + 1));
                }
                GetSkillStateInfo().AddSkill(4, new SkillInfo(playerData.m_RollSkill));

                // 武器数据
                for (int i = 0; i < playerData.m_WeaponList.Count; ++i)
                {
                    WeaponInfo      weaponInfo = new WeaponInfo(playerData.m_WeaponList[i]);
                    WeaponLogicData weaponData = weaponInfo.ConfigData;
                    if (null != weaponData)
                    {
                        GetShootStateInfo().AddWeapon(i, weaponInfo);
                        if (null == GetShootStateInfo().GetCurWeaponInfo())
                        {
                            GetShootStateInfo().SetCurWeaponInfo(weaponInfo.WeaponId);
                            GetShootStateInfo().CurrentWeaponIndex = i;
                        }
                        //todo:先按武器表里的武器配置上,后续需要从db里读取升级数据并初始化升级配置数据
                        EquipmentDataInfo equipDataInfo = new EquipmentDataInfo();
                        equipDataInfo.EquipmentConfig = EquipmentConfigProvider.Instance.GetEquipmentConfigById(weaponData.m_EquipmentId);
                        GetEquipmentStateInfo().EquipmentInfo.Weapons[i] = equipDataInfo;
                    }
                }

                //装备数据
                for (int i = 0; i < ShopEquipmentsId.Length; ++i)
                {
                    ShopEquipmentsId[i] = -1;
                }
                UserAttrCalculator.Calc(this);
                SetHp(Operate_Type.OT_Absolute, GetActualProperty().HpMax);
                SetRage(Operate_Type.OT_Absolute, 0);
                SetEnergy(Operate_Type.OT_Absolute, GetActualProperty().EnergyMax);
                SetEnergyCore(Operate_Type.OT_Absolute, GetActualProperty().EnergyCoreMax);
                for (int i = 0; i < playerData.m_WeaponList.Count; ++i)
                {
                    WeaponInfo      weaponInfo = GetShootStateInfo().GetWeaponInfoById(playerData.m_WeaponList[i]);
                    WeaponLogicData weaponData = weaponInfo.ConfigData;
                    if (null != weaponData)
                    {
                        //暴击数值
                        float CRIRATE_   = (float)(GetActualProperty().Critical / 480.0);
                        float CRIRATE_C_ = CriticalConfigProvider.Instance.GetC(CRIRATE_);
                        weaponInfo.CurCritical = CRIRATE_C_;
                    }
                }
            }
        }