2020-03-01 20:26:06 -05:00
|
|
|
using UnityEngine;
|
|
|
|
using UnityAtoms.BaseAtoms;
|
2019-10-15 19:43:51 -04:00
|
|
|
|
2020-03-01 20:26:06 -05:00
|
|
|
namespace UnityAtoms.MonoHooks
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Base class for all `MonoHook`s of type `Collider`.
|
|
|
|
/// </summary>
|
|
|
|
[EditorIcon("atom-icon-delicate")]
|
|
|
|
public abstract class ColliderHook : MonoHook<
|
|
|
|
ColliderEvent,
|
|
|
|
Collider,
|
|
|
|
GameObjectGameObjectFunction>
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Event including a GameObject reference.
|
|
|
|
/// </summary>
|
|
|
|
public ColliderGameObjectEvent EventWithGameObjectReference { get => _eventWithGameObjectReference; set => _eventWithGameObjectReference = value; }
|
|
|
|
|
|
|
|
[SerializeField]
|
|
|
|
private ColliderGameObjectEvent _eventWithGameObjectReference;
|
|
|
|
|
|
|
|
protected override void RaiseWithGameObject(Collider value, GameObject gameObject)
|
|
|
|
{
|
2020-03-02 13:36:52 -05:00
|
|
|
if (EventWithGameObjectReference)
|
|
|
|
{
|
|
|
|
EventWithGameObjectReference.Raise(new ColliderGameObject() { Collider = value, GameObject = gameObject });
|
|
|
|
}
|
2020-03-01 20:26:06 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|