using UnityEngine; using System.Collections; public class NoLivesLeftDetector : MonoBehaviour { public static NoLivesLeftDetector Instance; public ScreenBase noLivesLeftScreen; public ScreenBase noLivesLeftScreenTime; public ScreenBase NoLivesAddFriendForOneLiveGameOver; void Awake() { Instance = this; NotificationCenter.AddListener(OnTriedPlayingWithoutLivesLeft, NotificationType.TriedPlayingWithoutLivesLeft); } void OnDestroy() { NotificationCenter.RemoveListener(OnTriedPlayingWithoutLivesLeft, NotificationType.TriedPlayingWithoutLivesLeft); } void OnTriedPlayingWithoutLivesLeft(Notification note) { var curLive = LivesManager.Instance.Lives; //Debug.Log(curLive); if (curLive == 0) { MenuManager._instance.NoLivesShowAdInGame.Show(); } else if (curLive == 1) { noLivesLeftScreen.Show(); MenuManager._instance.UpdateCircle(); //PlayerPrefs.SetInt("Live", 2); } else { LivesManager.Instance.RechargeLife(); //PlayerPrefs.SetInt("Level", 0); PlayerPrefs.SetInt("Live", 0); PlayerPrefs.Save(); noLivesLeftScreenTime.Show(); } } }