Esempio n. 1
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     AudioManager.Play(AudioClipName.LostBall);
     reduceBallsEvent.Invoke();
     Destroy(collision.gameObject);
     Initialize();
 }
Esempio n. 2
0
    void Update()
    {
        if (_timerDeath.Finished)
        {
            DestroyAndSpawn();
        }

        if (gameObject.transform.position.y < ScreenUtils.ScreenBottom)
        {
            _ballsLeft.Invoke();
            AudioManager.Play(AudioClipName.LossBall);
            DestroyAndSpawn();
        }

        if (_timerMove.Finished)
        {
            _timerMove.Stop();
            StartMoving();
        }

        if (_timerSpeedupEffect.Finished)
        {
            _timerSpeedupEffect.Stop();
            _rigidbody2D.velocity *= 1 / _speedIncrease;
        }
    }
Esempio n. 3
0
 /// <summary>
 /// Destroy the ball if it isn't on the screen and add new ball
 /// </summary>
 private void OnBecameInvisible()
 {
     if (transform.position.y < ScreenUtils.ScreenBottom)
     {
         AudioManager.Play(AudioName.BallLost);
         reduceBallsLeft.Invoke();
         Destroy(gameObject);
     }
 }
Esempio n. 4
0
 void OnBecameInvisible()
 {
     ballLifetime.Stop();
     reduceBallsLeftEvent.Invoke();
 }