Exemple #1
0
 // If pickup hits player, add money, destroy pickup
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag == "Player")
     {
         gm.SetMoney(moneyUp);                               // Increase health
         sfx.PlaySound(sfx.coinPickup);                      // Play pickup sound
         ui.SetMoneyBGColor(pickupColor);                    // Color money BG yellow
         Destroy(this.gameObject);                           // Destroy pickup
     }
 }