Example #1
0
 void OnTriggerEnter2D(Collider2D collider) // If the player interacts with the powerup:
 {
     if (collider.gameObject.name == "Player")
     {
         player.AddHealth(24); // Increase the player's health.
         Destroy(gameObject);  // Remove the potion from the level.
     }
 }