Пример #1
0
    private void OnBubblePopped(int points)
    {
        _score += points;

        var scoreString = _score.ToString();

        _progressBar.value = _score / _nextLevelScore;

        if (_score > 10000)
        {
            var thousands        = _score / 10000;
            var hundreds         = _score - (thousands * 10000);
            var firstTwoHundreds = GetFirstTwoDigits(hundreds);
            scoreString = thousands + "k." + firstTwoHundreds;
        }

        _scoreText.text = scoreString;

        if (_score >= _nextLevelScore)
        {
            if (OnLevelUp != null)
            {
                OnLevelUp.Invoke();
            }
        }
    }
Пример #2
0
 public virtual void LevelUp()
 {
     if (OnLevelUp != null)
     {
         OnLevelUp.Invoke(CurrentValue);
     }
 }
Пример #3
0
        /// <summary>
        /// Add to the current experience and adjust the level.
        /// </summary>
        /// <param name="experience">The amount of experience to add.</param>
        public void AddExperience(int experience)
        {
            if (HasMaxExperience)
            {
                return;
            }

            Experience += experience;

            // Clamp experience
            if (Experience > MAX_EXPERIENCE)
            {
                Experience = MAX_EXPERIENCE;
            }

            // Set level
            int previousLevel = level;

            level     = CalculateLevel();
            MaxHealth = CalculateMaxHealth();

            // Check for level up
            if (Level != previousLevel)
            {
                OnLevelUp?.Invoke(this, EventArgs.Empty);
            }
        }
Пример #4
0
 private void Boss_OnDeath(IMonster boss, ulong reward)
 {
     Level++;
     OnMonsterDeath?.Invoke(boss, reward);
     OnLevelUp?.Invoke(Level);
     GenerateMinions();
     GenerateBoss();
 }
Пример #5
0
 public int LevelUp()
 {
     OnLevelUp?.Invoke(this, new LevelUpEventArgs(this));
     Level     += 1;
     Experience = ExpGroup.ExperienceNeededForLevel(Level);
     OnLevelledUp?.Invoke(this, new LevelledUpEventArgs(this));
     return(Level);
 }
Пример #6
0
 public void pbLevelUp(Combat.Pokemon pokemon, Combat.Pokemon battler, int oldtotalhp, int oldattack, int olddefense, int oldspeed, int oldspatk, int oldspdef)
 {
     if (OnLevelUp != null)
     {
         OnLevelUp.Invoke(this, new OnLevelUpEventArgs {
             Pokemon = pokemon, Battler = battler, HP = oldtotalhp, Atk = oldattack, Def = olddefense, Spe = oldspatk, Spa = oldspatk, Spd = oldspdef
         });
     }
 }
    public void LevelUp()
    {
        unitLevel++;
        availableStatPoints++;
        availableSkillPoints++;
        expToLevel = unitLevel * 50;
        OnLevelUp?.Invoke(this, 1000);

        Debug.Log("Player level up");
    }
Пример #8
0
        private void UpdateLevel()
        {
            var newLevel = CalculateLevel();

            if (_currentLevel.value < newLevel)
            {
                _currentLevel.value = newLevel;
                LevelUpEffect();
                OnLevelUp?.Invoke();
            }
        }
Пример #9
0
        private void SetLevelAndMaximumHitPoints()
        {
            int originalLevel = Level;

            Level = (ExperiencePoints / 100) + 1;
            if (Level != originalLevel)
            {
                MaximumHitPoints = Level * 10;
                OnLevelUp.Invoke(this, System.EventArgs.Empty);
            }
        }
Пример #10
0
        private void UpdateLevel()
        {
            var newLevel = CalculateLevel();

            if (newLevel <= _currentLevel.value)
            {
                return;
            }
            _currentLevel.value = newLevel;
            LevelUpEffect();
            OnLevelUp?.Invoke();
        }
Пример #11
0
        private void SetLevelAndMaxHP()
        {
            int originalLevel = level;

            level = (EXP / 100) + 1;

            if (level != originalLevel)
            {
                maxHP = level * 10;
                OnLevelUp?.Invoke(this, System.EventArgs.Empty);
            }
        }
Пример #12
0
 // Update is called once per frame
 void Update()
 {
     if (/*Input.GetMouseButton(0) &&*/ canFire)
     {
         StartCoroutine(Fire());
     }
     if (canLevelUp && transform.childCount == 0)
     {
         canLevelUp = false;
         OnLevelUp?.Invoke();
     }
 }
Пример #13
0
    public void AddExperience(int amount)
    {
        experience += amount;
        while (experience >= experienceToNextLevel)
        {
            experience -= experienceToNextLevel; //Сначала вычесть, так как experienceToNextLevel зависит от уровня!
            level++;
            experienceToNextLevel = CalculateExperienceToNextLevel(level);

            OnLevelUp?.Invoke();
        }
    }
Пример #14
0
    // Update is called once per frame
    void OnInteractorStay(Interactor interactor)
    {
        if (MaxLevel || DisableShop)
        {
            return;
        }
        if (_currentInteractor == interactor)
        {
            if (!interactor.TryingToBuild())
            {
                interactionTime = 0;
                CancelRadishes();
                return;
            }

            RaddishCarrier carrier = interactor.GetComponentInParent <RaddishCarrier>();
            Debug.Assert(carrier != null, "Need raddishcarrier in interactor parents");

            interactionTime += Time.fixedDeltaTime;
            if (interactionTime >= TimeToAddRaddish)
            {
                Raddish raddish = carrier.RemoveForNewTarget(RaddishTargets[RaddishesWaitingAtTarget.Count]);
                if (raddish != null)
                {
                    RaddishesWaitingAtTarget.Add(raddish);
                    interactionTime = 0;
                }

                if (EnoughRadishesToLevel())
                {
                    foreach (Raddish r in RaddishesWaitingAtTarget)
                    {
                        r.AnimateOutAndHide();
                    }
                    RaddishesUsed.AddRange(RaddishesWaitingAtTarget);
                    RaddishesWaitingAtTarget.Clear();

                    if (CurrentLevel < LevelRequirements.Count - 1)
                    {
                        CurrentLevel += 1;
                        OnLevelUp?.Invoke(CurrentLevel);
                    }
                    else
                    {
                        MaxLevel = true;
                    }

                    SetRaddishTargetsForNewLevel();
                }
            }
        }
    }
Пример #15
0
        private void LevelUp()
        {
            Level += 1;

            OnLevelUp?.Invoke(Level);

            foreach (var keyValuePair in Attributes)
            {
                keyValuePair.Value.LevelUp();
            }

            PlayLevelUpEffect();
        }
Пример #16
0
 private void Collect(float amount)
 {
     _experience += amount;
     if (_currentWeaponIndex < allWeapons.Length - 1)
     {
         if (_experience >= experienceLevel[_currentWeaponIndex + 1])
         {
             _currentWeaponIndex++;
             _weaponController.SwitchWeapon(GetCurrentWeapon());
             OnLevelUp?.Invoke(_currentWeaponIndex);
         }
     }
     OnExperienceChange?.Invoke(_experience);
 }
Пример #17
0
        private void UpdateLevel()
        {
            int newLevel = CalculateLevel();

            if (newLevel <= m_CurrentLevel.Value)
            {
                return;
            }
            m_CurrentLevel.Value = newLevel;
            if (OnLevelUp?.Invoke() == true)
            {
                LevelUpEffect();
            }
        }
Пример #18
0
            private void CheckForLevelUp()
            {
                if (IsAtMaxLevel)
                {
                    return;
                }

                while (experience > TotalExperienceForNextLevel)
                {
                    experience -= TotalExperienceForNextLevel;
                    level++;
                    OnLevelChange.Invoke(this, level);
                    OnLevelUp.Invoke(this, level);
                }
            }
Пример #19
0
            public void SetLevel(int level, bool resetExperience = true)
            {
                if (this.level != level)
                {
                    int oldLevel = this.level;
                    this.level = Mathf.Clamp(level, 1, MaxLevel);
                    if (resetExperience)
                    {
                        experience = 0f;
                    }

                    OnLevelChange.Invoke(this, level);
                    if (oldLevel < level)
                    {
                        OnLevelUp.Invoke(this, level);
                    }
                }
            }
Пример #20
0
    public void InitializingLevel(int level)
    {
        if (this.level == 0)
        {
            this.level = level;

            experienceToNextLevel = CalculateExperienceToNextLevel(level);

            for (int i = 0; i < level; i++)
            {
                OnLevelUp?.Invoke();
            }
        }
        else
        {
            Debug.LogError("Try to attempt to ReInitialize");
        }
    }
Пример #21
0
            public void ModifyLevel(int levelDifference, bool resetExperience = true)
            {
                if (levelDifference != 0)
                {
                    int oldLevel = this.level;
                    level = Mathf.Clamp(level + levelDifference, 1, MaxLevel);
                    if (resetExperience)
                    {
                        experience = 0f;
                    }

                    OnLevelChange.Invoke(this, level);
                    if (oldLevel < level)
                    {
                        OnLevelUp.Invoke(this, level);
                    }
                }
            }
Пример #22
0
    private void LevelUp() // Повышения уровня
    {
        if (currentExp >= player.MaxExperience)
        {
            currentExp = currentExp - player.MaxExperience;
            player.Level++;
            player.MaxHealth += 10;
            player.Strenght++;
            player.Dexterity++;
            playerView.ViewEffectLevelUp(transform.position);
            print("Plaeyr Level UP!");

            if (levelUp != null)
            {
                levelUp.Invoke();
            }
        }
        playerView.UpdateSliderExperience(currentExp);
    }
Пример #23
0
    public void LevelUp(int newLevel)
    {
        level.SetValue(newLevel);
        CanvasManager.UITextBindings["level"].text       = newLevel.ToString();
        CanvasManager.UITextBindings["avatarLevel"].text = newLevel.ToString();
        nextLevel.SetValue(ComputeNexLevel((int)level.GetValue()));
        skillPoints += 15;
        var stats = PlayerManager.Instance.Player.GetComponent <PlayerStats>();

        CanvasManager.UITextBindings["skillPoints"].text = stats.skillPoints.ToString();

        if (onLevelUp != null)
        {
            onLevelUp.Invoke(newLevel);
        }

        StatsCopy.armor       = stats.armor.GetBaseValue();
        StatsCopy.damage      = stats.damage.GetBaseValue();
        StatsCopy.maxHealth   = stats.maxHealth.GetBaseValue();
        StatsCopy.skillPoints = stats.skillPoints;

        //Debug.Log(StatsCopy.toString());
    }
Пример #24
0
        public void UpdateExperience(int delta)
        {
            var experienceAmount = AllEffects
                                   .Where(effect => effect is ExperienceEffect)
                                   .Select(effect => effect.Amount.Value)
                                   .Prepend(100f)
                                   .Max();

            Experience += (int)(delta * experienceAmount / 100f);
            if (Experience >= ExperienceRequired)
            {
                Level++;
                Experience         -= ExperienceRequired;
                ExperienceRequired += 100;

                foreach (var effect in Effects)
                {
                    effect.LevelUp();
                }

                UpdateStats();
                OnLevelUp?.Invoke(this, EventArgs.Empty);
            }
        }
Пример #25
0
    /*
     * public void setConstitution(int constitution) { this.constitution = constitution; }
     * public void setStrength(int strength) { this.strength = strength; }
     * public void setResistance(int resistance) { this.resistance = resistance; }
     * public void setAgility(int agility) { this.agility = agility; }
     * public void setAvailablePoints(int availablePoints) { this.availablePoints = availablePoints; }
     * public void setFireResistance(float fireResistance) { this.fireResistance = fireResistance; }
     * public void setPoisonResistance(float poisonResistance) { this.poisonResistance = poisonResistance; }
     * public void setParalyseResistance(float paralyseResistance) { this.paralyseResistance = paralyseResistance; }
     * public void setFearResistance(float fearResistance) { this.fearResistance = fearResistance; }
     */

    public void levelUp()
    {
        level++;
        hitPoints     += 5;
        actualLevelExp = nextLevelExp;
        nextLevelExp   = (nextLevelExp * getMultiplier());

        if (level % 3 == 0)
        {
            attack  += 2;
            defense += 2;
            speed   += 2;
        }
        else
        {
            attack++;
            defense++;
            speed++;
        }

        if (level % 5 == 0)
        {
            availablePoints += 2;
        }
        else
        {
            availablePoints++;
        }

        OnLevelUp?.Invoke();

        if (actualExp > nextLevelExp)
        {
            ObtainExp(0);
        }
    }
Пример #26
0
 public void UpgradeLevel()
 {
     ++_level;
     onLevelUp.Invoke(_level);
 }
Пример #27
0
 private void LevelUp()
 {
     OnLevelUp?.Invoke(_level);
     StartCoroutine(CoLevelUp());
 }
Пример #28
0
 internal static void InvokeOnLevelUp(int level)
 {
     OnLevelUp?.Invoke(level);
 }
Пример #29
0
 /// <summary>
 /// Invokes this character feature's OnLevelUp event. Generally, you should not call this yourself.
 /// </summary>
 protected internal void InvokeOnLevelUp(int level)
 {
     OnLevelUp?.Invoke(level);
 }
Пример #30
0
 public void LevelUp()
 {
     AvailablePoints += 1;
     OnLevelUp?.Invoke();
 }