示例#1
0
 public void RecordHero(string name, HeroData hero, HeroRecord record)
 {
     //name, baseStrGrowth, str, fameFavor, goldFavlor, lv, fieldName, diff, expRate, goldRate, exploreTime, exp, fame, gold,
     heroDataStr.AppendFormat("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10:0.0},{11},{12},{13}\n",
                              name, hero.baseStrGrowth, hero.strength, hero.fameFavour, hero.goldFavour, hero.level,
                              record.fieldName, record.diff, record.fameRate, record.goldRate, record.exploreTime, record.exp, record.fame, record.gold);
 }
示例#2
0
        //选择目的地
        void SearchTarget()
        {
            float highest = -Mathf.Infinity;
            Field target  = null;

            //便利所有野外,计算目标
            var fields = WorldManager.Instance.AllFields;

            while (fields.MoveNext())
            {
                var field = fields.Current;
                if (field.fieldData.resRemain > 0f)
                {
                    //获取得分最高的野外为移动目标
                    float curWeight = CalcFieldWeight(field);
                    //Debug.LogError(string.Format("{0} -> {1}", field.name, curWeight));
                    if (curWeight > highest)
                    {
                        target  = field;
                        highest = curWeight;
                    }
                }
            }

            //设置目标
            if (target != null)
            {
                m_fieldTarget = target;
                //切换状态
                State = HeroState.Move;

                string fieldName = m_fieldTarget.FieldName;

                //设置探索目标时新建记录
                HeroRecord record = null;
                if (!exploreRecord.TryGetValue(fieldName, out record))
                {
                    record = new HeroRecord();
                    exploreRecord.Add(fieldName, record);
                    curExploring = record;
                }
                record.fieldName   = fieldName;
                record.exp         = 0;
                record.fame        = 0;
                record.gold        = 0;
                record.exploreTime = 0f;
                record.diff        = m_fieldTarget.fieldData.difficulty;
                record.fameRate    = m_fieldTarget.fieldData.fameRate;
                record.goldRate    = m_fieldTarget.fieldData.goldRate;
            }
        }