24 lines
560 B
C#
24 lines
560 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
public class ClickableCollider : MonoBehaviour
|
|
{
|
|
public event Action<ClickableCollider, PointerEventData> OnClick;
|
|
|
|
public void Click(PointerEventData eventData) => OnClick?.Invoke(this, eventData);
|
|
|
|
public void Clear()
|
|
{
|
|
OnClick = null;
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
var proto = GetComponent<Prototype>();
|
|
if(proto != null)
|
|
proto.OnReturnToPool += () => OnClick = null;
|
|
}
|
|
}
|