12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- 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();
- }
-
- }
- }
|