holopy3/Assets/Scripts/SmileyTrigger.cs
2020-12-10 15:25:12 +01:00

19 lines
438 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SmileyTrigger : MonoBehaviour
{
public delegate void TriggerDelegate();
public static event TriggerDelegate OnEnterSmiley;
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Smiley"))
{
OnEnterSmiley?.Invoke();
Destroy(other.gameObject);
}
}
}