mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-23 16:48:23 -05:00
7763f81ede
* Unified all line endings in project to align with .editorconfig; all end-of-line characters have been set to LF and new-lines placed at the end of every file if not present.
29 lines
695 B
C#
29 lines
695 B
C#
using UnityEngine;
|
|
|
|
namespace UnityAtoms
|
|
{
|
|
public class MonoHook<E1, E2, EV, SF> : MonoBehaviour
|
|
where E1 : GameEvent<EV> where E2 : GameEvent<EV, GameObject>
|
|
where SF : GameFunction<GameObject, GameObject>
|
|
{
|
|
public E1 Event;
|
|
|
|
public E2 EventWithGORef;
|
|
|
|
[SerializeField]
|
|
protected SF SelectGORef;
|
|
|
|
protected void OnHook(EV value)
|
|
{
|
|
if (Event != null)
|
|
{
|
|
Event.Raise(value);
|
|
}
|
|
if (EventWithGORef != null)
|
|
{
|
|
EventWithGORef.Raise(value, SelectGORef != null ? SelectGORef.Call(gameObject) : gameObject);
|
|
}
|
|
}
|
|
}
|
|
}
|