public static bool PlayAd(UnityEngine.Events.UnityAction onAdPlay, UnityEngine.Events.UnityAction adNotAviable) { // fetch the video HZVideoAd.Fetch(); // Check for availability if (HZVideoAd.IsAvailable()) { // Show the ad HZVideoAd.Show(); // Callback if (null != onAdPlay) { onAdPlay.Invoke(); } // E x i t return(true); } // Failed debug it if (null != adNotAviable) { adNotAviable.Invoke(); } return(false); }
public void ShowVideo() { if (HZVideoAd.IsAvailable()) { HZVideoAd.Show(); } }
// Untouched code copied from AdCentral // ------------ private static bool PlayHeyzapVideoAd() { if (HZVideoAd.IsAvailable()) { HZVideoAd.Show(); HZVideoAd.Fetch(); return(true); } return(false); }
public void ShowVideoAd() { if (HZVideoAd.IsAvailable()) { HZVideoAd.Show(); } else { FetchVideoAd(); } }
public void ShowVideoAd() { if (canShowAd && !adsRemoved && HZVideoAd.IsAvailable()) { Toaster.ShowDebugToast("Showing Video ad"); HZVideoAd.Show(); } else { Toaster.ShowDebugToast("Can't show Video ad"); } }
public static bool PlayAd() { // fetch the video HZVideoAd.Fetch(); // Check for availability if (HZVideoAd.IsAvailable()) { // Show the ad HZVideoAd.Show(); // E x i t return(true); } return(false); }
public void NextLevel() { if (PlayerPrefs.GetInt("currentAdIteration") == 2) { PlayerPrefs.SetInt("currentAdIteration", 0); if (HZVideoAd.IsAvailable()) { HZVideoAd.Show(); } } else { PlayerPrefs.SetInt("currentAdIteration", PlayerPrefs.GetInt("currentAdIteration") + 1); } SceneManager.LoadScene(currentLevel + 1); }
IEnumerator End(float waitTime) { gameEnded = true; audioWhistle2.Play(); player.gameEnded = true; opponent.gameEnded = true; data.GetComponent <Data>().playerScore = pScore; data.GetComponent <Data>().oppScore = oScore; yield return(new WaitForSeconds(waitTime)); // // Show AD // if (Random.Range(0, 10) >= 2) { if (HZVideoAd.IsAvailable()) { HZVideoAd.Show(); } else { HZInterstitialAd.Show(); } } else { HZInterstitialAd.Show(); } // Show Menu menuBtn.SetActive(true); rematchBtn.SetActive(true); // // AD cache // StartCoroutine(AdCache(0.1F)); }
public void showHeyZapAds() { if (PlayerPrefs.HasKey("HeyZadAdcount")) { if (PlayerPrefs.GetInt("HeyZadAdcount") == 3) { HZInterstitialAd.Show(); PlayerPrefs.SetInt("HeyZadAdcount", 0); } else { if (HZVideoAd.IsAvailable()) { HZVideoAd.Show(); } PlayerPrefs.SetInt("HeyZadAdcount", PlayerPrefs.GetInt("HeyZadAdcount") + 1); } } else { PlayerPrefs.SetInt("HeyZadAdcount", 0); } }
void OnTriggerEnter2D(Collider2D other) { if (!gameEnded) { if (other.gameObject.tag == "Enemy" && !shieldActive) { ShieldPowerup.clip = lost; gameStarted = false; StartCoroutine(GameOverMenuDelay()); gameEnded = true; SpriteRenderer sr = this.GetComponent <SpriteRenderer> (); sr.enabled = false; foreach (GameObject x in arrows) { Arrow arrowScript = x.GetComponent <Arrow> (); arrowScript.gameStarted = false; arrowScript.gameStartedControl = true; x.SetActive(false); } GameObject z = GameObject.Find("EndOfGameScoreText"); Text score1 = z.GetComponent <Text> (); score1.text += scoreF.ToString("0.00"); //isTouched = false; scoreF = Mathf.Round(scoreF * 100f) / 100f; highScore = Mathf.Round(highScore * 100f) / 100f; // round to nearest 100th // Set taunts here Text tauntText = GameObject.Find("TauntText").GetComponent <Text> (); if (scoreF > highScore) { PlayerPrefs.SetFloat("Highscore", scoreF); highScore = scoreF; z = GameObject.Find("HighscoreText"); score1 = z.GetComponent <Text> (); score1.text += highScore.ToString("0.00"); int x = Random.Range(1, 4); // 3 taunts switch (x) { case 1: tauntText.text = "You've outdone yourself!"; tauntText.fontSize = 20; break; case 2: tauntText.text = "New highscore!"; tauntText.fontSize = 22; break; case 3: tauntText.text = "Well done!"; tauntText.fontSize = 22; break; } } else { // no new highscore if (scoreF < 15) { // below 15 seconds int x = Random.Range(1, 5); // 5 taunts switch (x) { case 1: tauntText.text = "Well, this is embarrassing"; tauntText.fontSize = 19; break; case 2: tauntText.text = "That's not all you've got,\nis it?!"; tauntText.transform.localPosition = new Vector3(tauntText.transform.localPosition.x, 18.7f, 0f); tauntText.fontSize = 18; break; case 3: tauntText.text = "Is that your best?"; tauntText.fontSize = 21; break; case 4: tauntText.text = "Uh-Oh"; tauntText.fontSize = 22; break; } } else if (scoreF >= (highScore - 3f) && scoreF < highScore) { // below highscore by 3 int x = Random.Range(1, 3); // 2 taunts switch (x) { case 1: tauntText.text = "So close!"; tauntText.fontSize = 22; break; case 2: tauntText.text = "A new highscore.. almost"; tauntText.fontSize = 20; break; } } else if (scoreF >= 15) { // above or equal to 15 seconds int x = Random.Range(1, 3); // 2 taunts switch (x) { case 1: tauntText.text = "Give it one more go"; tauntText.fontSize = 22; break; case 2: tauntText.text = "You can do better"; tauntText.fontSize = 22; break; } } z = GameObject.Find("HighscoreText"); score1 = z.GetComponent <Text> (); score1.text += highScore.ToString("0.00"); } //Video Ad if (totalPlayTime + Mathf.FloorToInt(scoreF) >= 90) { if (HZVideoAd.IsAvailable()) { PlayerPrefs.SetInt("Total Time Played Since Last ad", 0); HZVideoAd.Show(); } } else { PlayerPrefs.SetInt("Total Time Played Since Last ad", totalPlayTime + Mathf.FloorToInt(scoreF)); } } } }