Exemple #1
0
    // multiplier is the value by which to multiply the score
    // duration is the number of seconds to set the multiplier for
    public void SetCategoryPermanentMultiplier(float multiplier, sFood.FoodCategory foodCategory)
    {
        if (multiplier == 0)
        {
            Debug.LogError("ScoreSystem::SetCategoryPermanentMultiplier - multiplier should not be 0!");
            return;
        }

        _foodCategoryMultiplierBonus[foodCategory] = multiplier;

        UpdateMultipliersDisplay();
    }
Exemple #2
0
    // multiplier is the value by which to multiply the score
    // duration is the number of seconds to set the multiplier for
    public void SetCategoryTemporaryMultiplier(float multiplier, float duration, sFood.FoodCategory foodCategory)
    {
        if (multiplier == 0)
        {
            Debug.LogError("ScoreSystem::SetCategoryTemporaryMultiplier - multiplier should not be 0!");
            return;
        }

        if (duration <= 0)
        {
            Debug.LogError("ScoreSystem::SetCategoryTemporaryMultiplier - duration should be greater than 0!");
            return;
        }

        StartCoroutine(TemporaryCategoryScoreMultiplier(multiplier, duration, foodCategory));
    }
Exemple #3
0
    private IEnumerator TemporaryCategoryScoreMultiplier(float multiplier, float duration, sFood.FoodCategory foodCategory)
    {
        _foodCategoryMultiplierBonus[foodCategory] += multiplier;
        UpdateMultipliersDisplay();

        yield return(new WaitForSeconds(duration));

        _foodCategoryMultiplierBonus[foodCategory] -= multiplier;
        UpdateMultipliersDisplay();

        yield return(null);
    }