123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class VideoTimer : MonoBehaviour {
- public static VideoTimer Instance;
- public UILabel LabelTimer;
- public float TimeVideo;
- public bool Play;
- void Start () {
- Instance = this;
- }
-
- // Update is called once per frame
- void Update () {
- if(Play)
- {
- if(LabelTimer==null)
- {
- LabelTimer = NGUIMenuScript.Instance.LabelVideoTimer;
- }
- LabelTimer.gameObject.SetActive(true);
- TimeVideo -= Time.deltaTime;
-
- if (TimeVideo <=0 )
- {
- Play = false;
- //Adware.Instance.onFinished();
- AdManager.Instance.Active = false;
- #if UNITY_EDITOR
- Adware.Instance.RequesNextAd();
- Adware.Instance.Close();
- PlayerPrefs.SetInt("AddLifeStep", 2);
- InGameScriptCS.Instance.LifeLost = false;
- PlayerPrefs.Save();
- SoundManagerCS.Instance.EndVideoAd();
- #endif
- }
- LabelTimer.text = ((int)TimeVideo).ToString();
- }
- else
- {
- if (LabelTimer == null)
- {
- LabelTimer = NGUIMenuScript.Instance.LabelVideoTimer;
- }
- LabelTimer.gameObject.SetActive(false);
- }
-
- }
- }
|