Ejemplo n.º 1
0
 public void CheckProps()
 {
     if (props == null || props.Length == 0)
     {
         props = WarTestData.GetSoliderProps();
     }
 }
Ejemplo n.º 2
0
        /** 生成数据--士兵 */
        public void GenerationSoliders()
        {
            // 创建士兵UnitData
            foreach (KeyValuePair <int, StageLegionConfig> kvp in stageConfig.legionDict)
            {
                StageLegionConfig legionConfig = kvp.Value;
                UnitData          unitData     = new UnitData();
                unitData.unitType = UnitType.Solider;
                unitData.legionId = legionConfig.legionId;
                unitData.avatarId = 30101;

                LegionData legionData = legionDict[legionConfig.legionId];



                // 电脑士兵属性
                if (!HasEnterLegionData(unitData.legionId))
                {
                    Prop[] soliderModuleProps = WarTestData.GetSoliderProps();

                    float[] props = soliderModuleProps.PropsToInit_Float();
                    props[PropId.HpAdd]        = props[PropId.InitHp] = props[PropId.InitMaxHp];
                    legionData.soliderInitProp = props;

//					Debug.Log("Comupter soldierMonsterId= " + legionConfig.soldierMonsterId + " " +   props.ToStrProp());
                }
                // 玩家士兵属性
                else
                {
                    float[] props = GetSoliderProps(legionConfig.legionId).PropsToInit_Float();
                    props[PropId.HpAdd]        = props[PropId.InitHp] = props[PropId.InitMaxHp];
                    legionData.soliderInitProp = props;
                    unitData.level             = GetSoliderLevel(unitData.legionId);
                    unitData.avatarId          = GetSoliderAvatarId(unitData.legionId);

//					Debug.Log("soliderProps=" + props.ToStrProp());
                }

                // 把“士兵数据”保存到“势力数据"里
                legionData.soliderData = unitData;

//				Debug.Log(string.Format("<color=green>legionId={0}</color>", legionConfig.legionId));

                // 复制士兵斩将率到势力数据
                legionData.legionInitProp[PropId.InitKillHero] = WarFormula.WF_Legion_KillHero(legionData.soliderInitProp[PropId.InitKillHero]);
//				Debug.Log(string.Format("<color=green>legionId={0}, legionData.legionInitProp[PropId.InitKillHero]={1}</color>", legionConfig.legionId, legionData.legionInitProp[PropId.InitKillHero]));
            }
        }