Exemple #1
0
    IEnumerator ApplyStealthPotion(float duration, float affectAmount, bool isPercentage)
    {
        float tempAmountSubtracted = .5f;

        if (isPercentage)
        {
            playerProperties.ChangeDetectionModifierPercentage(affectAmount, out tempAmountSubtracted);
        }
        else
        {
            playerProperties.ChangeDetectionModifierFlatNumber(affectAmount);
        }
        Debug.Log("Coroutine Started, going to wait for " + duration + " seconds");
        yield return(new WaitForSecondsRealtime(duration));

        if (isPercentage)
        {
            playerProperties.ChangeDetectionModifierFlatNumber(0 - tempAmountSubtracted);
            Debug.Log("Aded " + tempAmountSubtracted + " to the detection modifier");
        }
        else
        {
            playerProperties.ChangeDetectionModifierFlatNumber(0 - affectAmount);
        }

        yield return(null);
    }