Пример #1
0
 private int GetWavesUnitID(int randomNum, TrainingWavesProto.TrainingWaves currentWave)
 {
     if (randomNum <= currentWave.Chance_1)
     {
         return(currentWave.UnitID_1);
     }
     else if (randomNum <= currentWave.Chance_2)
     {
         return(currentWave.UnitID_2);
     }
     else if (randomNum <= currentWave.Chance_3)
     {
         return(currentWave.UnitID_3);
     }
     else if (randomNum <= currentWave.Chance_4)
     {
         return(currentWave.UnitID_4);
     }
     else if (randomNum <= currentWave.Chance_5)
     {
         return(currentWave.UnitID_5);
     }
     else if (randomNum <= currentWave.Chance_6)
     {
         return(currentWave.UnitID_6);
     }
     else if (randomNum <= currentWave.Chance_7)
     {
         return(currentWave.UnitID_7);
     }
     else if (randomNum <= currentWave.Chance_8)
     {
         return(currentWave.UnitID_8);
     }
     else if (randomNum <= currentWave.Chance_9)
     {
         return(currentWave.UnitID_9);
     }
     else if (randomNum <= currentWave.Chance_10)
     {
         return(currentWave.UnitID_10);
     }
     else
     {
         DebugUtils.LogError(DebugUtils.Type.Training, "TrainingMode soldier spwan all chance is not happend, Check the design!");
         return(-1);
     }
 }
Пример #2
0
        private BattleUnit UnitLevelPropertyRatio(BattleUnit unitData, TrainingWavesProto.TrainingWaves currentWave)
        {
            //TODO:If need change init unit value.Need modify waveTable like endlessWaveTable

            int waveLV = 0;

            for (int i = 0; i < unitData.props.Count; i++)
            {
                if (unitData.props[i].propertyType == PropertyType.MaxHealth)
                {
                    unitData.props[i].propertyValue = unitData.props[i].propertyValue * currentWave.UnitLevel_PropertyRatio * waveLV;
                }
                else if (unitData.props[i].propertyType == PropertyType.HealthRecover)
                {
                    unitData.props[i].propertyValue = unitData.props[i].propertyValue * currentWave.UnitLevel_PropertyRatio * waveLV;
                }
                else if (unitData.props[i].propertyType == PropertyType.PhysicalAttack)
                {
                    unitData.props[i].propertyValue = unitData.props[i].propertyValue * currentWave.UnitLevel_PropertyRatio * waveLV;
                }
                //else if( unitData.props[ i ].propertyType == PropertyType.RangedDmgBase )
                //{
                //	unitData.props[ i ].propertyValue += unitData.props[ i ].propertyValue * currentWave.UnitLevel_PropertyRatio * waveLV;
                //}
                else if (unitData.props[i].propertyType == PropertyType.AttackRange)
                {
                    unitData.props[i].propertyValue = unitData.props[i].propertyValue * currentWave.UnitLevel_RangeRatio * waveLV;
                }
                //else if( unitData.props[ i ].propertyType == PropertyType.AttackRadius )
                //{
                //	unitData.props[ i ].propertyValue += unitData.props[ i ].propertyValue * currentWave.UnitLevel_DamageRadiusRatio * waveLV;
                //}
                else if (unitData.props[i].propertyType == PropertyType.Speed)
                {
                    unitData.props[i].propertyValue = unitData.props[i].propertyValue * currentWave.UnitLevel_SpeedRatio * waveLV;
                }
                else
                {
                    DebugUtils.Log(DebugUtils.Type.Training, "This prop not need modify value about TrainingWaves table");
                    continue;
                }
            }

            return(unitData);
        }
Пример #3
0
        private void InitTrainingModeUnitData(object sampleData, TrainingGenerateType dataType)
        {
            List <int>             trainingModeUnitUIDList = new List <int>();
            List <UnitsProto.Unit> unitsTempDatas          = DataManager.GetInstance().unitsProtoData;

            if (dataType == TrainingGenerateType.Normaly)
            {
                TrainingWavesProto.TrainingWaves data = (TrainingWavesProto.TrainingWaves)sampleData;

                trainingModeUnitUIDList.Add(data.UnitID_1);
                trainingModeUnitUIDList.Add(data.UnitID_2);
                trainingModeUnitUIDList.Add(data.UnitID_3);
                trainingModeUnitUIDList.Add(data.UnitID_4);
                trainingModeUnitUIDList.Add(data.UnitID_5);
                trainingModeUnitUIDList.Add(data.UnitID_6);
                trainingModeUnitUIDList.Add(data.UnitID_7);
                trainingModeUnitUIDList.Add(data.UnitID_8);
                trainingModeUnitUIDList.Add(data.UnitID_9);
                trainingModeUnitUIDList.Add(data.UnitID_10);
            }
            else if (dataType == TrainingGenerateType.Tutorial)
            {
                //TODO: Need add tutorial table data.
            }
            else
            {
                DebugUtils.LogError(DebugUtils.Type.Training, string.Format("Training can't know this type {0}", dataType));
            }

            for (int i = 0; i < trainingModeUnitUIDList.Count; i++)
            {
                if (trainingModeUnitUIDList[i] == 0 || trainingModeUnitUIDList[i] == -1)
                {
                    continue;
                }

                BattleUnit      model = new BattleUnit();
                UnitsProto.Unit data  = DataManager.GetInstance().unitsProtoData.Find(p => p.ID == trainingModeUnitUIDList[i]);

                if (data == null)
                {
                    DebugUtils.LogError(DebugUtils.Type.Training, string.Format("The Training mode unit id error, can't find this unit id {0} unit, please check this.", trainingModeUnitUIDList[i]));
                }

                PropertyInfo physicalAttack = new PropertyInfo();
                physicalAttack.propertyType  = PropertyType.PhysicalAttack;
                physicalAttack.propertyValue = data.PhysicalAttack;
                model.props.Add(physicalAttack);

                PropertyInfo magicAttackValue = new PropertyInfo();
                magicAttackValue.propertyType  = PropertyType.MagicAttack;
                magicAttackValue.propertyValue = data.MagicAttack;
                model.props.Add(magicAttackValue);

                PropertyInfo armor = new PropertyInfo();
                armor.propertyType  = PropertyType.ArmorPro;
                armor.propertyValue = data.Armor;
                model.props.Add(armor);

                PropertyInfo magicResist = new PropertyInfo();
                magicResist.propertyType  = PropertyType.MagicResist;
                magicResist.propertyValue = data.MagicResist;
                model.props.Add(magicResist);

                PropertyInfo criticalChance = new PropertyInfo();
                criticalChance.propertyType  = PropertyType.CriticalChance;
                criticalChance.propertyValue = data.CriticalChance;
                model.props.Add(criticalChance);

                PropertyInfo criticalDamage = new PropertyInfo();
                criticalDamage.propertyType  = PropertyType.CriticalDamage;
                criticalDamage.propertyValue = data.CriticalDamage;
                model.props.Add(criticalDamage);

                PropertyInfo moveSpeed = new PropertyInfo();
                moveSpeed.propertyType  = PropertyType.Speed;
                moveSpeed.propertyValue = data.MoveSpeed;
                model.props.Add(moveSpeed);

                PropertyInfo rangedMitigation = new PropertyInfo();
                rangedMitigation.propertyType  = PropertyType.AttackSpeed;
                rangedMitigation.propertyValue = data.AttackInterval;
                model.props.Add(rangedMitigation);

                PropertyInfo attackRange = new PropertyInfo();
                attackRange.propertyType  = PropertyType.AttackRange;
                attackRange.propertyValue = data.AttackRange;
                model.props.Add(attackRange);

                PropertyInfo health = new PropertyInfo();
                health.propertyType  = PropertyType.MaxHealth;
                health.propertyValue = data.Health;
                model.props.Add(health);

                PropertyInfo healthRegen = new PropertyInfo();
                healthRegen.propertyType  = PropertyType.HealthRecover;
                healthRegen.propertyValue = data.HealthRegen;
                model.props.Add(healthRegen);

                trainingModeUnitData.Add(trainingModeUnitUIDList[i], model);
            }
        }