public int UpdateValues() { var newLevel = Mathf.Max(0, Mathf.FloorToInt(1 - Mathf.Log(Mathf.Max(1, xp) / baseLevelXP, levelIncreaseCoefficient))) + 1; var levelXP = Mathf.Pow(levelIncreaseCoefficient, 1 - newLevel) * baseLevelXP; var progress = xp / levelXP; progressBar.progress = progress; progressBar.UpdateButton(); if (newLevel != level) { if (level != -1) { LevelUp.Show(newLevel); } level = newLevel; levelLabel.text = $"Level {newLevel}"; } xpLabel.text = $"{xp} / {levelXP}"; displayedAnimationToggle.Displayed = newLevel > 1; return(newLevel); }
void LevelUp() { DifficultType difficult = DifficultType.NONE; CurrentLevel++; if (difficultyStepsQueue.Count == 0) { if (score % 15 == 0) { difficult = !rotator.canUseCrazySpeed ? DifficultType.SWITCH_CRAZY_SPEED : DifficultType.SWITCH_CRAZY_SPEED_CANCEL; } else if (score % 10 == 0) { difficult = DifficultType.SPEEDUP; } else if (score % 5 == 0) { difficult = !rotator.canInverseDir ? DifficultType.SWITCH_REVERSE : DifficultType.SWITCH_REVERSE_CANCEL; } } else { pointsRequiredToLevelUpQueue.Dequeue(); difficult = difficultyStepsQueue.Dequeue(); } switch (difficult) { case DifficultType.MORE_COLORS: spawner.AddColorsInGame(1); AudioMaster.instance.Play(SoundDefinitions.SFX_SPEED); break; case DifficultType.SPEEDUP: rotator.RotationSpeed += 25; AudioMaster.instance.Play(SoundDefinitions.SCRATCH_7); break; case DifficultType.SWITCH_REVERSE: rotator.StartInverseDirection(); //canInverseDir = true; AudioMaster.instance.Play(SoundDefinitions.SFX_REVERSE); break; case DifficultType.SWITCH_REVERSE_CANCEL: rotator.StopInverseDirection(); //canInverseDir = false; AudioMaster.instance.Play(SoundDefinitions.SFX_REVERSE); break; case DifficultType.SWITCH_CRAZY_SPEED: rotator.StartCrazySpeed(); AudioMaster.instance.Play(SoundDefinitions.SCRATCH_10); break; case DifficultType.SWITCH_CRAZY_SPEED_CANCEL: rotator.StopCrazySpeed(); AudioMaster.instance.Play(SoundDefinitions.SCRATCH_10); break; } levelUp.Show(difficult); //Debug.LogFormat ("<color=green>Level {0} a los {1} puntos -> Dificultad añadida: {2}</color>", currentLevel, score, difficult.ToString ()); }
public void Show(GameObject obj) { if (CurrentCritter != null) { Hide(_state); } GameSystems.TimeEvent.PauseGameTime(); if (obj != CurrentCritter) { ResetPages(); } CurrentCritter = obj; Inventory.Container = obj; _mainWidget.Visible = true; _mainWidget.BringToFront(); Stats.Show(); Portrait.Show(obj); if (_state == CharInventoryState.Unknown6) { CurrentPage = 7; Spells.Show(CurrentCritter); } else if (_state != CharInventoryState.LevelUp) { switch (CurrentPage) { case 0: case 1: case 2: case 3: case 4: Inventory.Show(obj); break; case 5: Skills.Show(); break; case 6: Feats.Show(CurrentCritter); break; case 7: Spells.Show(CurrentCritter); break; default: Logger.Warn("Showing default character sheet page (inventory)."); Inventory.Show(obj); break; } } switch (_state) { case CharInventoryState.Looting: case CharInventoryState.Bartering: case CharInventoryState.Unknown6: Looting.Show(null); break; case CharInventoryState.LevelUp: CurrentPage = 9; LevelUp.Show(); break; } CenterOnScreen(); Help.Show(); HandleLootingTutorialTopics(); }