private void Start() { //Makes sure it's invisible and untouchable. m_uiCanvasGroup.interactable = false; m_uiCanvasGroup.DOFade(0f, 0f); RequestInterstitialAd interAd = this.gameObject.AddComponent <RequestInterstitialAd>(); m_interAd = interAd.LoadAd(); //Add the button action. m_restartButton.onClick.AddListener(() => { RestartGame(); }); }
private void TriggerGameOver() { //Trigger an ad. RequestInterstitialAd interAd = GetComponent <RequestInterstitialAd>(); m_interAd = interAd.m_ad;//This returns the Ad if (!interAd.m_ad.IsLoaded()) { //Not loaded. Request. m_interAd = interAd.RequestInterstitial(); } m_interAd.Show(); m_scoreTracker.HideScore(); //Clean up. m_interAd.OnAdClosed += (o, e) => { ActivateUI();//Game Over UI. }; }