using UnityEngine; using UnityAtoms.BaseAtoms; namespace UnityAtoms.MonoHooks { /// /// Base class for all `MonoHook`s of type `Collider`. /// [EditorIcon("atom-icon-delicate")] public abstract class ColliderHook : MonoHook< ColliderEvent, Collider, ColliderEventReference, GameObjectGameObjectFunction> { /// /// Event including a GameObject reference. /// public ColliderGameObjectEvent EventWithGameObject { get => _eventWithGameObjectReference != null ? _eventWithGameObjectReference.GetEvent() : null; set { if (_eventWithGameObjectReference != null) { _eventWithGameObjectReference.SetEvent(value); } } } [SerializeField] private ColliderGameObjectEventReference _eventWithGameObjectReference = default(ColliderGameObjectEventReference); protected override void RaiseWithGameObject(Collider value, GameObject gameObject) { if (EventWithGameObject) { EventWithGameObject.Raise(new ColliderGameObject() { Collider = value, GameObject = gameObject }); } } } }