Exemplo n.º 1
0
    private void OnCollisionEnter(Collision collision)
    {
        if (livesRemaining > 0)
        {
            if (collision.gameObject.tag.ToString() == "Basket")
            {
                launched = false;

                score.IncrementScore();

                rigid.velocity = new Vector3(0, 0, 0);
                rigid.gameObject.transform.localPosition = new Vector3(0f, 1.5f, 80f);

                NewPos();
                Launch();
            }

            if (collision.gameObject.tag.ToString() == "Platform" && livesRemaining > 1)
            {
                launched = false;

                livesRemaining--;
                lives.DecreaseLives();

                rigid.velocity = new Vector3(0, 0, 0);
                rigid.gameObject.transform.localPosition = new Vector3(0f, 1.5f, 80f);

                NewPos();
                Launch();
            }

            else if (collision.gameObject.tag.ToString() == "Platform" && livesRemaining <= 1)
            {
                livesRemaining--;
                lives.DecreaseLives();

                score.GameOver();
                Invoke("EndLevel", 4);
            }
        }
    }
Exemplo n.º 2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        lives.DecreaseLives();

        if (Lives.lives <= 0)
        {
            levelManager.LoadLevel("Lose");
        }
        else
        {
            ball.SetHasStarted(false);
        }
    }
Exemplo n.º 3
0
 private void ProcessHit(DamageDealer damageDealer)
 {
     playerPU.DecreaseHealth(damageDealer.GetDamage());
     damageDealer.Hit();
     if (playerPU.GetHealth() <= 0)
     {
         Die();
         if (lives.GetLivesCount() >= 1)
         {
             lives.DecreaseLives();
             FindObjectOfType <SceneLoader>().LoadCurrentScene();
             playerPU.ResetPowerUps();
         }
         else if (lives.GetLivesCount() < 1)
         {
             FindObjectOfType <SceneLoader>().LoadGameOver();
         }
     }
 }