Пример #1
0
    // Use this for initialization
    void Start()
    {
        storeInformation = GameObject.FindGameObjectWithTag("StoreInformation").GetComponent <StoreInformation>();
        if (SceneManager.GetActiveScene().name == "Scene1")
        {
            instantiatePoop = GameObject.FindGameObjectWithTag("MainScript").GetComponent <InstantiatePoop>();
        }


#if UNITY_ANDROID
        string appId = "ca-app-pub-7498255284251761~5601353189";
#elif UNITY_IPHONE
        string appId = "ca-app-pub-3940256099942544~1458002511";
#else
        string appId = "unexpected_platform";
#endif

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);
        this.rewardBasedVideo = RewardBasedVideoAd.Instance;
        // RewardBasedVideoAd is a singleton, so handlers should only be registered once.
        this.rewardBasedVideo.OnAdLoaded             += this.HandleRewardBasedVideoLoaded;
        this.rewardBasedVideo.OnAdFailedToLoad       += this.HandleRewardBasedVideoFailedToLoad;
        this.rewardBasedVideo.OnAdOpening            += this.HandleRewardBasedVideoOpened;
        this.rewardBasedVideo.OnAdStarted            += this.HandleRewardBasedVideoStarted;
        this.rewardBasedVideo.OnAdRewarded           += this.HandleRewardBasedVideoRewarded;
        this.rewardBasedVideo.OnAdClosed             += this.HandleRewardBasedVideoClosed;
        this.rewardBasedVideo.OnAdLeavingApplication += this.HandleRewardBasedVideoLeftApplication;

        this.RequestRewardBasedVideo();
    }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     instantiatePoop  = GameObject.FindGameObjectWithTag("MainScript").GetComponent <InstantiatePoop>();
     instantiateCoins = GameObject.FindGameObjectWithTag("MainScript").GetComponent <Coins>();
     storeInformation = GameObject.FindGameObjectWithTag("StoreInformation").GetComponent <StoreInformation>();
 }