public override void Init() { complexBattleParam = new DataUnit.BasicBattleParam(); complexBattleParam.Copy(dataUnit.battleParam); Model_Unit modelUnit = new Model_Unit(); modelUnit.Parse(pbUnit); DataUnitPart[] dataParts = modelUnit.GetDataParts(); foreach (DataUnitPart part in dataParts) { complexBattleParam.Add(part.battleParam); } if (heroId > 0) { DataHero dataHero = DataManager.instance.dataHeroGroup.GetHero(heroId, pbHero.exp, pbHero.stage); complexBattleParam.Add(dataHero.basicParam); } complexBattleParam.damage *= powerScale; complexBattleParam.ammo *= powerScale; complexBattleParam.hp *= unitCount; currentHp = complexBattleParam.hp; }
public static int CalcUnitPower(int unitId, int unitCount, int heroId) { Model_Unit modelUnit = InstancePlayer.instance.model_User.unlockUnits [unitId]; DataUnit dataUnit = DataManager.instance.dataUnitsGroup.GetUnit(unitId); DataUnitPart[] dataUnitParts = modelUnit.GetDataParts(); int pHero = 0; if (heroId > 0) { SlgPB.Hero modelHero = InstancePlayer.instance.model_User.model_heroGroup.GetHero(heroId); DataHero dataHero = DataManager.instance.dataHeroGroup.GetHero(heroId, modelHero.exp, modelHero.stage); pHero = dataHero.basicParam.CalcPower(); } int pUnit = dataUnit.battleParam.CalcPower(); int pTotal = pHero + pUnit * unitCount; foreach (DataUnitPart dataUnitPart in dataUnitParts) { if (dataUnitPart != null) { int pPart = dataUnitPart.battleParam.CalcPower(); pTotal += pPart; } } return(pTotal); }
virtual public void Init() { complexBattleParam = new DataUnit.BasicBattleParam(); complexBattleParam.Copy(_dataUnit.battleParam); if (isPlayerUnit) { if (InstancePlayer.instance.model_User.isLogin) { Model_Unit modelUnit = InstancePlayer.instance.model_User.unlockUnits [unitId]; DataUnitPart[] dataParts = modelUnit.GetDataParts(); foreach (DataUnitPart part in dataParts) { complexBattleParam.Add(part.battleParam); } } if (heroId > 0) { SlgPB.Hero hero = InstancePlayer.instance.model_User.model_heroGroup.GetHero(heroId); DataHero dataHero = DataManager.instance.dataHeroGroup.GetHero(heroId, hero.exp, hero.stage); complexBattleParam.Add(dataHero.basicParam); } } complexBattleParam.damage *= powerScale; complexBattleParam.ammo *= powerScale; complexBattleParam.hp *= unitCount; currentHp = complexBattleParam.hp; }
void InitData() { _strengthenTankItemDic.Clear(); List <int> unlockUnits = InstancePlayer.instance.model_User.unlockUnitsId; List <DataUnit> dataUnitList = new List <DataUnit>(); dataUnitList.Clear(); foreach (int id in unlockUnits) { DataUnit dataunit = DataManager.instance.dataUnitsGroup.GetUnit(id); dataUnitList.Add(dataunit); } TankDataManager tankManagetr = new TankDataManager(); _unitDataList = tankManagetr.StrengthenSort(dataUnitList); if (_unitDataList.Count > 0) { _currentUnitData = _unitDataList[0]; UpdataTankInfo(_currentUnitData); _units = InstancePlayer.instance.model_User.unlockUnits; _units.TryGetValue(_currentUnitData.id, out _modelUnit); _unitPart = _modelUnit.GetDataParts(); _currentUnitPart = _unitPart[0]; _partType = SystemType.HP; UpdataUnitPart(_currentUnitPart, _partType); } }
void UpdataPromptPoint(TankDataManager.UnitData unitData) { if (unitData == null) { return; } DataUnitPart[] unitPart = _modelUnit.GetDataParts(); bool isshow = false; int count = unitPart.Length; for (int i = 0; i < count; i++) { PBConnect_upgradeUnitPart.RESULT result = PBConnect_upgradeUnitPart.CheckUpgrade(_modelUnit.unitId, i); isshow = result == PBConnect_upgradeUnitPart.RESULT.OK ? true:false; if (isshow) { break; } } _redPoint.gameObject.SetActive(isshow); }