maxhacker11

Collector.cs

Dec 3rd, 2023
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.30 KB | Source Code | 0 0
  1. using UnityEngine;
  2.  
  3. public class Collector : MonoBehaviour
  4. {
  5.     private void OnTriggerEnter2D(Collider2D collision)
  6.     {
  7.         ICollectible collectible = collision.GetComponent<ICollectible>();
  8.  
  9.         if(collectible != null)
  10.         {
  11.             collectible.Collect();
  12.         }
  13.     }
  14. }
  15.  
Tags: COLLECTIBLES
Advertisement
Add Comment
Please, Sign In to add comment