2020-03-29 04:19:24 +01:00
|
|
|
|
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);
|
2020-04-23 03:31:17 +01:00
|
|
|
|
|
2020-04-29 11:27:55 +01:00
|
|
|
|
public void Clear()
|
|
|
|
|
|
{
|
|
|
|
|
|
OnClick = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-23 03:31:17 +01:00
|
|
|
|
void Start()
|
|
|
|
|
|
{
|
|
|
|
|
|
var proto = GetComponent<Prototype>();
|
|
|
|
|
|
if(proto != null)
|
|
|
|
|
|
proto.OnReturnToPool += () => OnClick = null;
|
|
|
|
|
|
}
|
2020-03-29 04:19:24 +01:00
|
|
|
|
}
|