namespace Tilia.Interactions.Interactables.Interactables.Grab.Action
{
using UnityEngine;
using Zinnia.Data.Attribute;
using Zinnia.Event.Proxy;
using Zinnia.Extension;
using Zinnia.Tracking.Collision.Active.Event.Proxy;
///
/// Describes an action to perform when a Grab Process is executed.
///
public class GrabInteractableAction : MonoBehaviour
{
#region Input Settings
[Header("Input Settings")]
[Tooltip("The input ActiveCollisionConsumerEventProxyEmitter for the grab action.")]
[SerializeField]
[Restricted]
private ActiveCollisionConsumerEventProxyEmitter inputActiveCollisionConsumer;
///
/// The input for the grab action.
///
public ActiveCollisionConsumerEventProxyEmitter InputActiveCollisionConsumer
{
get
{
return inputActiveCollisionConsumer;
}
set
{
inputActiveCollisionConsumer = value;
}
}
[Tooltip("The input GameObjectEventProxyEmitter for the grab action.")]
[SerializeField]
[Restricted]
private GameObjectEventProxyEmitter inputGrabReceived;
///
/// The input for the grab action.
///
public GameObjectEventProxyEmitter InputGrabReceived
{
get
{
return inputGrabReceived;
}
set
{
inputGrabReceived = value;
}
}
[Tooltip("The input GameObjectEventProxyEmitter for the grab action.")]
[SerializeField]
[Restricted]
private GameObjectEventProxyEmitter inputUngrabReceived;
///
/// The input for the grab action.
///
public GameObjectEventProxyEmitter InputUngrabReceived
{
get
{
return inputUngrabReceived;
}
set
{
inputUngrabReceived = value;
}
}
[Tooltip("The input GameObjectEventProxyEmitter for any pre setup on grab.")]
[SerializeField]
[Restricted]
private GameObjectEventProxyEmitter inputGrabSetup;
///
/// The input for any pre setup on grab.
///
public GameObjectEventProxyEmitter InputGrabSetup
{
get
{
return inputGrabSetup;
}
set
{
inputGrabSetup = value;
}
}
[Tooltip("The input GameObjectEventProxyEmitter for any post reset on ungrab.")]
[SerializeField]
[Restricted]
private GameObjectEventProxyEmitter inputUngrabReset;
///
/// The input for any post reset on ungrab.
///
public GameObjectEventProxyEmitter InputUngrabReset
{
get
{
return inputUngrabReset;
}
set
{
inputUngrabReset = value;
}
}
#endregion
///
/// Backing field for
///
private GrabInteractableConfigurator grabSetup;
///
/// The internal setup for the grab action.
///
public GrabInteractableConfigurator GrabSetup
{
get
{
return grabSetup;
}
set
{
grabSetup = value;
if (this.IsMemberChangeAllowed())
{
OnAfterGrabSetupChange();
}
}
}
///
/// Notifies that the Interactable is being grabbed.
///
/// The grabbing object.
public virtual void NotifyGrab(GameObject data)
{
GrabSetup.NotifyGrab(data);
}
///
/// Notifies that the Interactable is no longer being grabbed.
///
/// The previous grabbing object.
public virtual void NotifyUngrab(GameObject data)
{
GrabSetup.NotifyUngrab(data);
}
///
/// Called after has been changed.
///
protected virtual void OnAfterGrabSetupChange() { }
}
}