예제 #1
0
 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.tag == "Player")   //player has collided with coin
     {
         CoinCounter.incrementCoinCount(); //add 1 coin to the coin count on the display (canvas)
         Destroy(gameObject);              //destroy coin because we picked it up
     }
 }