holopy3/Assets/Scripts/SmileyTrigger.cs

20 lines
438 B
C#
Raw Normal View History

2020-12-10 14:25:12 +00:00
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);
}
}
}