public static void Down() { if (UnityAdsHelper.isReady()) { UnityAdsHelper.ShowAd(); } }
IEnumerator Start() { string zoneName = string.IsNullOrEmpty(zoneID) ? "the default ad placement zone" : zoneID; _startTime = Time.timeSinceLevelLoad; while (!UnityAdsHelper.isInitialized) { if (Time.timeSinceLevelLoad - _startTime > timeout) { Debug.LogWarning("Unity Ads failed to initialize in a timely manner. Ad will not be shown on load."); yield break; } yield return(new WaitForSeconds(_yieldTime)); } _startTime = Time.timeSinceLevelLoad; while (!UnityAdsHelper.isReady(zoneID)) { if (Time.timeSinceLevelLoad - _startTime > timeout) { Debug.LogWarning(string.Format("The process of showing ads on load for {0} has timed out. Ad was not shown.", zoneName)); yield break; } yield return(new WaitForSeconds(_yieldTime)); } Debug.Log(string.Format("Ads for {0} are available and ready. Showing ad now...", zoneName)); UnityAdsHelper.ShowAd(zoneID, !disablePause); }
public void OnMouseDown() { if (UnityAdsHelper.isReady()) { UnityAdsHelper.ShowAd(); } Time.timeScale = 1f; LedEffect.t = 2f; Application.LoadLevel("Menu"); }
void OnMouseUpAsButton() { if (UnityAdsHelper.isReady(zoneID)) { UnityAdsHelper.ShowAd(zoneID, !disablePause); } else { Debug.LogWarning("Unable to show ad. Zone is not yet ready."); } }
void OnMouseDown() { if (UnityAdsHelper.isReady()) { Ads.Down(); } else { Bichapp.SetActive(false); } }
void Update() { if (showAds) { if (UnityAdsHelper.isReady()) { UnityAdsHelper.Show(); } showAds = false; } }
// A return type of IEnumerator allows for the use of yield statements. // For more info, see: http://docs.unity3d.com/ScriptReference/YieldInstruction.html IEnumerator Start() { // Zone name used in debug messages. string zoneName = string.IsNullOrEmpty(zoneID) ? "the default ad placement zone" : zoneID; // Set a start time for the timeout. _startTime = Time.timeSinceLevelLoad; // Check to see if Unity Ads is initialized. // If not, wait a second before trying again. while (!UnityAdsHelper.isInitialized) { if (Time.timeSinceLevelLoad - _startTime > timeout) { Debug.LogWarning("Unity Ads failed to initialize in a timely manner. Ad will not be shown on load."); // Break out of both this loop and the Start method; Unity Ads will not // be shown on load since the wait time exceeded the time limit. yield break; } yield return(new WaitForSeconds(_yieldTime)); } Debug.Log("Unity Ads has finished initializing. Waiting for ads to be ready..."); // Set a start time for the timeout. _startTime = Time.timeSinceLevelLoad; // Check to see if Unity Ads are available and ready to be shown. // If not, wait a second before trying again. while (!UnityAdsHelper.isReady(zoneID)) { if (Time.timeSinceLevelLoad - _startTime > timeout) { Debug.LogWarning(string.Format("The process of showing ads on load for {0} has timed out. Ad was not shown.", zoneName)); // Break out of both this loop and the Start method; Unity Ads will not // be shown on load since the wait time exceeded the time limit. yield break; } yield return(new WaitForSeconds(_yieldTime)); } Debug.Log(string.Format("Ads for {0} are available and ready. Showing ad now...", zoneName)); // Show ad after Unity Ads finishes initializing and ads are ready to show. UnityAdsHelper.ShowAd(zoneID, !disablePause); }
void OnGUI() { bool isReady = UnityAdsHelper.isReady(s2sRedeemZoneID); bool pause = !disablePause; GUI.enabled = isReady; if (GUI.Button(new Rect(Screen.width - 310, 10, 300, 50), isReady ? "Show Ad With S2S Redeem Callback" : "Waiting...")) { Debug.Log(string.Format("Ad Placement zone with ID of {0} is {1}. This zone is using S2S Redeem Callback functionality.", string.IsNullOrEmpty(s2sRedeemZoneID) ? "null" : s2sRedeemZoneID, isReady ? "ready" : "not ready")); if (isReady) { UnityAdsHelperExt.ShowAd(s2sRedeemZoneID, pause); } } GUI.enabled = true; }
void OnGUI() { bool isReady = UnityAdsHelper.isReady(zoneID); bool pause = !disablePause; GUI.enabled = isReady; if (GUI.Button(new Rect(10, 10, 150, 50), isReady ? "Show Ad" : "Waiting...")) { Debug.Log(string.Format("Ad Placement zone with ID of {0} is {1}.", string.IsNullOrEmpty(zoneID) ? "null" : zoneID, isReady ? "ready" : "not ready")); if (isReady) { UnityAdsHelper.ShowAd(zoneID, pause); } } GUI.enabled = true; }
void Update() { if (UnityAdsHelper.isReady(_button.zoneID)) { collider.enabled = true; Vector3 rotation = transform.localRotation.eulerAngles; rotation += Vector3.up * rotationSpeed * Time.deltaTime; transform.localRotation = Quaternion.Euler(rotation); transform.localPosition = MoveTowards(_initialPos); } else { collider.enabled = false; transform.localPosition = MoveTowards(_disabledPos); } }