Exemple #1
0
 public void BubbleTiming()
 {
     if (bubbleSystem.IsAbleProduce)
     {
         lastBubbleTime++;
         if (IsCompleteTimer(lastBubbleTime, bubbleSystem.BubbleEndTime))
         {
             BubbleSystem.SetActive(PoolObject, false);
             if (IsReward)
             {
                 Reward();
                 pushGameObjectInPool(vehicles, PoolObject);
             }
         }
         if (IsCompleteTimer(lastBubbleTime, bubbleSystem.BubbleTables[(int)vehicles].bubbleUpTime))
         {
             PoolObject = popGameObjectInPool(vehicles);
             PoolObject.transform.position = BubbleSystem.ConvertWorldToScreenPoint(transform.position);
             PoolObject.GetComponent <UnityEngine.UI.Button>().onClick.RemoveAllListeners();
             PoolObject.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(() =>
             {
                 Reward();
                 pushGameObjectInPool(vehicles, PoolObject);
             });
             BubbleSystem.SetActive(PoolObject, true);
             lastBubbleTime = 0;
             IsReward       = true;
             SoundManager.Instance.PlayOneShot("BubbleUp");
         }
     }
 }
Exemple #2
0
 IEnumerator EUpdate()
 {
     while (true)
     {
         PoolObject.transform.position
             = BubbleSystem.ConvertWorldToScreenPoint(transform.position);
         yield return(null);
     }
 }
Exemple #3
0
 IEnumerator EUpdate(GameObject poolObject, GameObject bubble)
 {
     while (poolObject.activeInHierarchy)
     {
         poolObject.transform.position
             = BubbleSystem.ConvertWorldToScreenPoint(bubble.transform.position);
         yield return(null);
     }
 }
Exemple #4
0
        IEnumerator EInit()
        {
            if (this.vehicles == Vehicles.STORAGE)
            {
                yield break;
            }

            yield return(new WaitForSeconds(bubbleSystem.BubbleTables[(int)vehicles].bubbleUpTime));

            PoolObject = popGameObjectInPool(vehicles);
            PoolObject.transform.position = BubbleSystem.ConvertWorldToScreenPoint(transform.position);
            PoolObject.GetComponent <UnityEngine.UI.Button>().onClick.RemoveAllListeners();
            PoolObject.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(() =>
            {
                Reward();
                pushGameObjectInPool(vehicles, PoolObject);
            });
            StartCoroutine(EUpdate());

            GameEvent.Instance.SubscribeBubbleEvent(() => { BubbleTiming(); });
        }
Exemple #5
0
 private void Start()
 {
     bubbleSystem = BubbleSystem.Instance;
     StartCoroutine(EInit());
 }