public void OnDisableCurrentWave()
    {
        if (_multiplier > 2)
        {
            _score += _multiplier;

            int count = 0;
            while (_multiplier != 1)
            {
                count++;
                _multiplier /= 2;
            }
            _countUserfulInLevel -= count;
        }
        else if (_touchUnUserfulBubble && _multiplier == 2)
        {
            _score += 2;
            _countUserfulInLevel -= 1;
        }

        if (_countUserfulInLevel == 0 && _currentLives > 0)
        {
            OnEndLevel?.Invoke(true);
        }
        else if (_countUserfulInLevel == 1 && GameObject.FindGameObjectWithTag("Bubble") == null)
        {
            OnEndLevel?.Invoke(false);
        }

        _touchUnUserfulBubble = false;
        _scoreLabel.text      = _score.ToString();
        _multiplier           = 1;
    }
    public void OnTouchMortalBubble()
    {
        _touchUnUserfulBubble = true;

        _currentLives--;

        if (_currentLives < 1)
        {
            OnEndLevel?.Invoke(false);
        }

        OnLivesChanged?.Invoke(_currentLives);
    }
Пример #3
0
        public void LoseLevel()
        {
#if FULLLOG
            MoreDebug.Log(".");
#endif
            OnEndLevel.Invoke();
            if (Campaign == null)
            {
                WrapUp();
            }
            else
            {
                Campaign.LoseLevel();
            }
        }
 private void OnTriggerEnter(Collider other)
 {
     if (other.transform == m_Player)
     {
         Debug.Log("Masuk");
         if (m_HasAllLemonCollected)
         {
             EndLevel(m_SuccessBackground, m_SuccessAudio);
             OnEndLevel?.Invoke();
         }
         else
         {
             Debug.Log("Collect lemons!");
             OnCollectMoreLemon?.Invoke();
         }
     }
 }
Пример #5
0
 IEnumerator EndLevel()
 {
     Debug.Log("GameController: EndLevel");
     if (OnEndLevel != null)
     {
         OnEndLevel.Invoke();
     }
     else
     {
         _state = GameState.EndLevelComplete;
     }
     while (_state != GameState.EndLevelComplete)
     {
         yield return(null);
     }
     // TEMP
     UpdateGameState(GameState.GameOver);
 }
Пример #6
0
 public static void EndLevel(bool isWin) => OnEndLevel?.Invoke(isWin);