void SetExpBar(float gainPoint, int level) { var maxPointAtLevel = LevelCalculator.GetMaxPointAt(level); var minPointAtLevel = LevelCalculator.GetMinPointAt(level); if (gainPoint > maxPointAtLevel) { maxPointAtLevel = LevelCalculator.GetMaxPointAt(level + 1); minPointAtLevel = LevelCalculator.GetMinPointAt(level + 1); } var realRangeInBar = maxPointAtLevel - minPointAtLevel; var expPoint = gainPoint - minPointAtLevel; expBar.SetValue(expPoint, realRangeInBar, false); expBar.SetLabel(gainPoint, maxPointAtLevel); }
void Update() { int up; LevelCalculator.maxLevel = maxLevel; LevelCalculator.seed = seed; _dynamicLevel = LevelCalculator.Up(_race.gainPoint, level, out up); if (_dynamicLevel > level) { level = _dynamicLevel; upLevel = up; GetModules <ILevelUpEventHandler> (x => { x.OnLevelUp(level, upLevel); }); } }