maxhacker11

Gem.cs

Dec 3rd, 2023
547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | Source Code | 0 0
  1. using System;
  2. using UnityEngine;
  3.  
  4. public class Gem : MonoBehaviour, ICollectible
  5. {
  6.     public static event Action OnGemCollected;
  7.  
  8.     // Example of using particles
  9.     //public ParticleSystem collectParticle;
  10.  
  11.     public void Collect()
  12.     {
  13.         OnGemCollected?.Invoke();
  14.  
  15.         // This is where you can play sounds or spawn particles
  16.         //Instantiate(collectParticle, transform.position, Quaternion.identity);
  17.  
  18.         Debug.Log("Gem collected!");
  19.         Destroy(gameObject);
  20.     }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment