Example #1
0
    public void ShowEvent(AdsEvent adsEvent)
    {
        Console.OutputEncoding = System.Text.Encoding.UTF8;

        if (!rulesIndex.ContainsKey(adsEvent))
        {
            Debug.LogError("ADS: \"" + adsEvent + "\": Rule is not defined!");
            return;
        }

        var rule = rulesIndex[adsEvent];

        showCount[rule]++;

        var count = showCount[rule] - rule.skip;

        Debug.Log("ADS: \"" + adsEvent + "\": Counter = " + count + ", Rate = " + rule.rate + ".");

        if (count <= 0)
        {
            Debug.Log("ADS: \"" + adsEvent + "\": " + showCount[rule] + " call is skipped (first " + rule.skip + " calls are skipped).");
            return;
        }

        if (count % rule.rate == 0)
        {
            Debug.Log("ADS: \"" + adsEvent + "\": Counter is multiple of " + rule.rate + ", so ADS is meant to be shown.");
            Show(rule.delay, false);
        }
    }
 SimpleStateMachine <AdsEvent> .State HandleUnbinding(AdsEvent raisedEvent)
 {
     return(stateMachine.GetStateByName(k_StateNameDisabled));
 }