void OnTriggerEnter2D(Collider2D other)
    {
        if (other.name == "Player")
        {
            //player collects coin
            //print("you've collected a coin");

            CoinCounter.AddPoints(coinValue);

            Destroy(gameObject);
        }
    }
Exemplo n.º 2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        //Destroys enemies on contact with projectiles. Adds points.
        if (other.tag == "Enemy")
        {
            Instantiate(enemyDeath, other.transform.position, other.transform.rotation);
            Destroy(other.gameObject);
            CoinCounter.AddPoints(pointsForKill);
        }

        Destroy(gameObject);
    }