Esempio n. 1
0
    public void OnTriggerEnter2D(Collider2D collision)
    {
        Destroy(collision.gameObject);

        if (collision.gameObject.tag == "GoodBox")
        {
            gameManager.score += gameManager.packageValues[0];
            gameManager.successRate++;
            vfx.GoodPickupParticles();
            vfx.addPointsPromptMethod();
            ripple.Ripple();
            audioObject.GoodPickupSound();

            greenCollected = true;
        }
        else if (collision.gameObject.tag == "BadBox")
        {
            if (gameManager.score >= 543)
            {
                gameManager.score += gameManager.packageValues[1];
            }
            else
            {
                gameManager.score = 0;
            }
            gameManager.successRate -= 3;
            gameManager.lives--;
            vfx.CamShake();
            vfx.BadPickupParticles();
            vfx.subtractPointsPromptMethod();
            ui.MinusOneLifeFeedback();
            audioObject.BadPickupSound();
        }

        else if (collision.gameObject.tag == "LifeBox")
        {
            gameManager.lives++;
            ripple.Ripple();
            ui.PlusOneLifeFeedback();
            audioObject.LifePickupSound();
        }
    }