Você está na página 1de 2

using System.

Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.Monetization;

public class AdController : MonoBehaviour {

public static AdController instance;

private string store_id = "112333";

private string video_ad = "video";

public void Awake()

if (instance != null) {

Destroy (gameObject);

} else {

instance = this;

DontDestroyOnLoad (gameObject);

void Start () {

//while publising game false;

Monetization.Initialize (store_id, false);

void Update () {
}

public void ShowVideoOrInterstitialAD(){

if (PlayerPrefs.HasKey ("Adcount")) {

if (PlayerPrefs.GetInt ("Adcount") == 3) {

if (Monetization.IsReady (video_ad)) {

ShowAdPlacementContent ad = null;

ad = Monetization.GetPlacementContent (video_ad)
as ShowAdPlacementContent;

if (ad != null) {

ad.Show ();

PlayerPrefs.SetInt ("Adcount", 0);

} else {

PlayerPrefs.SetInt ("Adcount", PlayerPrefs.GetInt


("Adcount") + 1);

else {

PlayerPrefs.SetInt ("Adcount", 0);

Você também pode gostar