// Use this for initialization private void Awake() { DontDestroyOnLoad(this.gameObject); if (instance == null) { // the current instanc of the class instance = this; } else { // destroy the current gameobject Destroy(this.gameObject); } }
void OnTriggerEnter2D(Collider2D other) { if (dead) { return; } GameObject go = other.gameObject; switch (go.tag) { case "Exit": UnityAds.ShowAd(); sound.play = Sound.VICTORY; victory = true; break; case "Enemy": if (shielded) { shielded = false; ds.shields--; ds.Save(); enemyCol = go.GetComponents <Collider2D> (); for (int i = 0; i < enemyCol.Length; i++) { enemyCol[i].enabled = false; } trail.SetActive(false); Debug.Log("perdi o shield"); } else { Debug.Log("morri"); sound.play = Sound.DEAD; dead = true; } break; case "Water": sound.play = Sound.DEAD; dead = true; diedInLiquid = true; break; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_banner_ad); bannerView = FindViewById <View>(Resource.Id.bannerView); // Declare a new banner listener, and set it as the active banner listener: UnityBanners.BannerListener = new UnityBannerListener(this); // Initialize the Ads SDK: UnityAds.Initialize(this, _unityGameID, new UnityAdsListener(), _isTestMode); var showAdButton = FindViewById <Button>(Resource.Id.showAdButton); showAdButton.Click += ShowAdButton_Click; }
private void Start() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else if (instance != this) { Destroy(gameObject); } Advertisement.AddListener(this); Initialize(); }
void Start() { Debug.Log("AdManager Started"); List <string> deviceIds = new List <string>(); deviceIds.Add("19EB01B237AD9FBA44A428C0A30235E7"); /* RequestConfiguration requestConfiguration = new RequestConfiguration * .Builder() * .SetTestDeviceIds(deviceIds) * .build(); * MobileAds.SetRequestConfiguration(requestConfiguration);*/ Debug.Log("Test devices are set"); MobileAds.Initialize(HandleInitCompleteAction); UnityAds.SetGDPRConsentMetaData(true); loginClient = GameObject.Find("LoginClient").GetComponent <LoginClient>(); }
private void Awake() { if (!instance) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } Advertisement.AddListener(this); Advertisement.Initialize(gameId); SceneManager.sceneLoaded += PegaBtn; }
void Awake() { instance = this; if (Application.platform == RuntimePlatform.Android) { Advertisement.Initialize("1688999", false); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { Advertisement.Initialize("1689000", false); } else { Advertisement.Initialize("1689000", false); } }
void Start() { ads = this; if (Application.platform == RuntimePlatform.Android) { Advertisement.Initialize("1179839", false); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { Advertisement.Initialize("1179838", false); } else { Advertisement.Initialize("1179838", false); } }
//Step 4 modify purchasing public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args) { if (String.Equals(args.purchasedProduct.definition.id, removeAds, StringComparison.Ordinal)) { Debug.Log("remove ads for this user"); if (PlayerPrefs.HasKey("ads") == false) { PlayerPrefs.SetInt("ads", 0); } UnityAds.RemoveBanner(); GameObject.Find("txt_rm_ads").GetComponent <TMPro.TextMeshProUGUI>().text = "Thank You"; } else { Debug.Log("Purchase Failed"); } return(PurchaseProcessingResult.Complete); }
void Update() { /* if (player.transform.position.x < leftBoundary) * player.transform.position = new Vector3 (leftBoundary, player.transform.position.y, player.transform.position.z); * * if (player.transform.position.x > rightBoundary) * player.transform.position = new Vector3 (rightBoundary, player.transform.position.y, player.transform.position.z); */ keyCounter.text = keys + "/" + totalKeys; coinCounter.text = coins + "/" + totalCoins; if (player.gameOver) { GameOver(); } if (gameOverMenu.activeSelf) { UpdateRevives(); } if (ds.revives == 0 && UnityAds.AdAvailable()) { watchAd.interactable = true; } else { watchAd.interactable = false; } if (ds.revives > 0) { revive.interactable = true; } else { revive.interactable = false; } if (player.victory) { Victory(); } }
// Use this for initialization void Start() { rateShow = PlayerPrefs.GetInt("Rate"); flipsCount = PlayerPrefs.GetInt("Flips"); startPoint = GameObject.FindGameObjectWithTag("StartPointNew").transform; rb = GetComponent <Rigidbody>(); ui = GameObject.FindGameObjectWithTag("GameController").GetComponent <UIControls>(); ads = GameObject.FindGameObjectWithTag("GameController").GetComponent <UnityAds>(); forcePower = flippyObject.forcePower; torquePower = flippyObject.torquePower; rb.mass = flippyObject.mass; startRotation = transform.rotation; source = GetComponent <AudioSource>(); flipAudioClip = flippyObject.flipSound; }
void Awake() { if (instance != null) { Destroy(gameObject); } else { DontDestroyOnLoad(gameObject); instance = this; #if ALLINONE_ADMOB adMob = GetComponent <AdMob> (); #endif #if ALLINONE_UNITYADS unityAds = GetComponent <UnityAds> (); #endif #if ALLINONE_CHARTBOOST chartboost = GetComponent <ChartboostAds.ChartboostAds> (); #endif } }
// Both Ad Type Initialization private void InitializeAds() { adMobAds = new AdMobAds(); unityAds = new UnityAds(); }
private void OnClick(GameObject go) { if (isInMotion) { return; } // don't accept clicks if it's in motion if (!isHiding) // if the clipboard is visible { if (go.tag == "appointment") // if clicking an appointment { SetNextLevelUp(go.GetComponent <Appointment>()); createAndDestroyLevelRef.GetStartFromClipboard(); currentLevelDifficulty = GetNextLevelUp().myLevel.difficulty; // store level difficulty for scoring currentLevelNumBlocks = GetNextLevelUp().myLevel.level; // bring up the ShowMe banner if not first level // ShowMe stuff Appointment _currentAppointment = GetNextLevelUp(); if (!(_currentAppointment.GetMyDayIndex() == 0 && _currentAppointment.GetMyLevelIndex() == 0)) { StartCoroutine(SlideObject(new LerpPackage(showMeBanner, showMeInPosition, showMeOutPosition))); } // log event to game manager gameManager.Event_AppointmentStart(); // chance to show ad if not 1st or 2nd day if (!SaveGame.GetHasUpgraded() && _currentAppointment.GetMyDayIndex() >= 2) { UnityAds.ShowPlacementAdChance(3, 1); } } else if (go.name == "BackButton_red" || go.name == "BackButton_yellow" || go.name == "DoneButton") // if clicking the "back" or "done" button, go back { GoBack(); } else if (go.name == "RestartFromResultsScreenButton") // if clicking the restart button from the clipboard, immediately restart previous level { HideClipboard(); Invoke("CloseResultsPage", timeToSwap); // the following includes some copy/paste from the previous appointment start section. I'm not proud of that. createAndDestroyLevelRef.GetStartFromClipboard(); Appointment _currentAppointment = GetNextLevelUp(); if (_currentAppointment.GetMyDayIndex() < daysToShowBanner) { StartCoroutine(SlideObject(new LerpPackage(showMeBanner, showMeInPosition, showMeOutPosition))); } gameManager.Event_AppointmentStart(); MetricsLogger.Instance.LogCustomEvent("Appointment", "RestartUsed", gameManager.FormatDayAndLevel()); } } else { if (buttonState == 1 && (go.name == "BackButton_red" || go.name == "BackButton_yellow" || go.name == "DoneButton")) // click the "back" button to give up on the level { createAndDestroyLevelRef.RoundEnd(false); } else if (go == showMeBanner) { if (SaveGame.GetHasSeenShowMe(nextLevelUp.GetMyDayIndex(), nextLevelUp.GetMyLevelIndex()) || SaveGame.GetHasUpgraded()) { StartShowMe(); } else { GameObject.Find("NotificationManager").GetComponent <NotificationManager>().DisplayNotification(24, true); } } else if (go.name.StartsWith("UpgradeButton_Unlock")) { Upgrade.PurchaseUpgrade(1); MetricsLogger.Instance.LogBusinessEvent("US Dollars", 199, "GameUpgrade", "N/A", "N/A", "N/A", "N/A"); } else if (go.name.StartsWith("UpgradeButton_Cancel")) { // do nothing, the notification will disappear } else if (go.name.StartsWith("UpgradeButton_WatchIt")) { UnityAds.ShowRewardedAd(0); } } }
public void OnClick() { UnityAds.ShowWatchAdvertForCoins(Coins); }
void Start() { instance = this; }
void Start() { UnityAds.ShowAdvert(); }
public void ShowRewardedAd() { UnityAds.ShowRewardedAd("revive"); }
void Awake() { ads = GameObject.Find("IAP Listener").GetComponent <UnityAds>(); }
public void ShowVideoAd() { UnityAds.show("16-default"); }
private void Start() { unityAds = FindObjectOfType <UnityAds>(); sceneLoader = FindObjectOfType <SceneLoader>(); }
protected override void DoInit() { base.DoInit(); ads = GetComponent <UnityAds>(); }
/// <summary> /// Initialize. /// </summary> public void Initialize(Action onCompleteCallback = null) { #if DEBUG_MY_ADMOB Debug.Log("[" + typeof(MyAdMobManager).Name + "] Initialize()"); #endif if (mTestEnable && mTestDeviceId.Length > 0) { if (mTestUseGoogleAdsId) { mAndroidDefaultBannerId = "ca-app-pub-3940256099942544/6300978111"; mAndroidDefaultInterstitialAdId = "ca-app-pub-3940256099942544/1033173712"; mAndroidDefaultRewardedAdId = "ca-app-pub-3940256099942544/5224354917"; mIosDefaultBannerId = "ca-app-pub-3940256099942544/2934735716"; mIosDefaultInterstitialAdId = "ca-app-pub-3940256099942544/4411468910"; mIosDefaultRewardedAdId = "ca-app-pub-3940256099942544/1712485313"; #if UNITY_ANDROID PlayerPrefs.SetString("MyAdMobManager_BannerId", mAndroidDefaultBannerId); PlayerPrefs.SetString("MyAdMobManager_InterstitialAdId", mAndroidDefaultInterstitialAdId); PlayerPrefs.SetString("MyAdMobManager_RewardedAdId", mAndroidDefaultRewardedAdId); #elif UNITY_IOS PlayerPrefs.SetString("MyAdMobManager_BannerId", mIosDefaultBannerId); PlayerPrefs.SetString("MyAdMobManager_InterstitialAdId", mIosDefaultInterstitialAdId); PlayerPrefs.SetString("MyAdMobManager_RewardedAdId", mIosDefaultRewardedAdId); #endif } List <string> deviceIds = new List <string>(); deviceIds.AddRange(mTestDeviceId.Split(';')); RequestConfiguration requestConfiguration = new RequestConfiguration.Builder().SetTestDeviceIds(deviceIds).build(); MobileAds.SetRequestConfiguration(requestConfiguration); } MobileAds.Initialize(initStatus => { #if DEBUG_MY_ADMOB Debug.Log("[" + typeof(MyAdMobManager).Name + "] Initialize(): completed"); #endif mIsInitialized = true; if (onCompleteCallback != null) { onCompleteCallback(); } }); #if USE_MY_ADMOB_APPLOVIN AppLovin.Initialize(); AppLovin.SetHasUserConsent(true); #endif #if USE_MY_ADMOB_MOPUB MoPub.InitializeSdk("8c09b6f2cb324838acf2fdad6899f5a8"); #endif #if USE_MY_ADMOB_UNITY_ADS UnityAds.SetGDPRConsentMetaData(true); #endif #if USE_MY_ADMOB_VUNGLE Vungle.UpdateConsentStatus(VungleConsent.ACCEPTED); #endif }
private void Awake() { instance = this; }
public void GetCoins() { UnityAds.ShowRewardedAd("coins"); ds.Save(); }