namespace Tilia.Interactions.Interactables.Interactables.Grab
{
using UnityEngine;
///
/// Restricts the ability to drop a grabbed .
///
public class InteractableGrabDropRestrictor : MonoBehaviour
{
///
/// Disables the drop on the given Interactable.
///
/// The Interactable to disable on.
public virtual void DoDisableDrop(GameObject interactable)
{
DisableDrop(interactable);
}
///
/// Enables the drop on the given Interactable.
///
/// The Interactable to enable on.
public virtual void DoEnableDrop(GameObject interactable)
{
EnableDrop(interactable);
}
///
/// Disables the drop on the given Interactable.
///
/// The Interactable to disable on.
public virtual void DoDisableDrop(InteractableFacade interactable)
{
DisableDrop(interactable);
}
///
/// Enables the drop on the given Interactable.
///
/// The Interactable to enable on.
public virtual void DoEnableDrop(InteractableFacade interactable)
{
EnableDrop(interactable);
}
///
/// Disables the drop on the given Interactable.
///
/// The Interactable to disable on.
/// Whether the drop was disabled.
public static bool DisableDrop(GameObject interactable)
{
if (interactable == null)
{
return false;
}
return DisableDrop(interactable.GetComponent());
}
///
/// Enables the drop on the given Interactable.
///
/// The Interactable to enable on.
/// Whether the drop was enabled.
public static bool EnableDrop(GameObject interactable)
{
if (interactable == null)
{
return false;
}
return EnableDrop(interactable.GetComponent());
}
///
/// Disables the drop on the given Interactable.
///
/// The Interactable to disable on.
/// Whether the drop was disabled.
public static bool DisableDrop(InteractableFacade interactable)
{
if (interactable == null || interactable.GrabbingInteractors.Count == 0)
{
return false;
}
interactable.DisableGrabReceiver();
return true;
}
///
/// Enables the drop on the given Interactable.
///
/// The Interactable to enable on.
/// Whether the drop was enabled.
public static bool EnableDrop(InteractableFacade interactable)
{
if (interactable == null)
{
return false;
}
interactable.EnableGrabReceiver();
return true;
}
}
}