public static void CheckLevel(GameObject unit) { var nextLevel = GetLevelAdvancement(unit.StatsComponent.Level); if (unit.StatsComponent.Experience >= nextLevel) { unit.StatsComponent.Level++; PerformDefaultAdvancement(unit.StatsComponent); AudioProcessor.PlaySoundEffect(Constants.SoundEffects.FXSounds.LEVEL_UP); UIProcessor.SetFloatingText(Constants.UI.DEFAULT_FLOATING_TEXT_DURATION, "Level UP!", unit.PhysicsComponent.position, Color.YellowGreen); } }
public static void GainExperience(GameObject unit, int experience) { UIProcessor.SetFloatingText(Constants.UI.DEFAULT_FLOATING_TEXT_DURATION, "EXP +" + experience, unit.PhysicsComponent.position, Color.YellowGreen); unit.StatsComponent.Experience += experience; CheckLevel(unit); }