Esempio n. 1
0
    void OnCollisionEnter(Collision col)
    {
        if (col.gameObject.CompareTag("Ground"))
        {
            grounded = true;
        }

        if (col.gameObject.CompareTag("Coin"))
        {
            gameManager.addMoeda(1);
            Destroy(col.gameObject);
            //print ("Colide with Coin");
        }

        if (col.gameObject.CompareTag("Enemy"))
        {
            gameManager.lostMoeda(moedasPerdidas);
            Destroy(col.gameObject);
            //print ("Colide with Enemy");
            if (gameManager.getNoite())
            {
                gameManager.GameOver();
            }
        }
    }
Esempio n. 2
0
    void OnCollisionEnter(Collision col)
    {
        if (col.gameObject.CompareTag("Enemy"))
        {
            Destroy(gameObject);
            Destroy(col.gameObject);
        }

        if (col.gameObject.CompareTag("Coin"))
        {
            gameManager.addMoeda(quantMoedas);
            Destroy(gameObject);
            Destroy(col.gameObject);
        }
    }