namespace VRTK.Prefabs.Interactions.Interactables.Grab.Action
{
using UnityEngine;
using VRTK.Prefabs.Interactions.Interactables.Grab.Provider;
///
/// Describes the action of swapping a an action from being the secondary action to the primary action.
///
///
/// Can only be used in conjunction with .
///
public class GrabInteractableSwapAction : GrabInteractableAction
{
///
/// Resets the toggle state on the Grab Receiver.
///
/// The Interactor to remove from the toggle state.
public virtual void ResetToggle(GameObject interactor)
{
GrabSetup.GrabReceiver.ToggleList.Remove(interactor);
}
///
/// Clears the stack.
///
public virtual void ClearStack()
{
ToStackInteractorProvider(GrabSetup.GrabProvider).EventStack.PopAt(0);
}
///
/// Emits the active collision payload.
///
public virtual void EmitActiveCollisionConsumerPayload()
{
GrabSetup.GrabReceiver.OutputActiveCollisionConsumer.EmitPayload();
}
///
/// Pushes the given Interactor to the stack.
///
/// The Interactor to push to the stack.
public virtual void PushToStack(GameObject interactor)
{
ToStackInteractorProvider(GrabSetup.GrabProvider).EventStack.Push(interactor);
}
///
/// Casts a given to the required type.
///
/// The base provider to cast.
/// The casted provider.
protected virtual GrabInteractableStackInteractorProvider ToStackInteractorProvider(GrabInteractableInteractorProvider provider)
{
return (GrabInteractableStackInteractorProvider)provider;
}
}
}