Esempio n. 1
0
        public int UpgradeLevel()
        {
            var newExp = State.Exp;

            if (State.Level == Static.Levels.Count)
            {
                return(State.Level);
            }
            var neededLevel = State.Level + 1;
            var level       = Static.Levels.Values.FirstOrDefault(x => x.Level == neededLevel);

            while (level != null && newExp >= level.ExpMin && neededLevel < Static.Levels.Count + 1)
            {
                neededLevel++;
                LogicLog.UpdatePlayerLevel(State.Level, newExp);
                level = Static.Levels.Values.FirstOrDefault(x => x.Level == neededLevel);
            }
            State.Level = neededLevel - 1;
            var expMin = GetLevel(State.Level).ExpMin;

            State.Exp = level == null ? expMin : newExp;
            return(State.Level);
        }