Código:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using GoogleMobileAds.Api;
using UnityEngine.UI;
public class AdmobScript : MonoBehaviour
{
int CoinOld;
public Text coins;
public string VideoAdID;
RewardBasedVideoAd MyRewardVideoAd;
// Use this for initialization
void Start ()
{
MyRewardVideoAd = RewardBasedVideoAd.Instance;
}
public void LoadVideoAd() {
if (!MyRewardVideoAd.IsLoaded()) {
AdRequest request = new AdRequest.Builder().Build();
MyRewardVideoAd.LoadAd(request, VideoAdID);
}
}
public void ShowVideoAd() {
if (MyRewardVideoAd.IsLoaded())
{
MyRewardVideoAd.Show();
}
else
{
LoadVideoAd();
}
}
public void HandleRewardBasedVideoRewarded(object sender, Reward args) {
CoinOld += 200;
coins.text = "" + CoinOld;
}
}