// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) VRMADA, All rights reserved.
//
// --------------------------------------------------------------------------------------------------------------------
using UltimateXR.Core.Serialization;
namespace UltimateXR.Manipulation
{
public partial class UxrGrabManager
{
#region Private Types & Data
///
/// Stores information to handle grab events () for
/// objects:
///
/// -
///
///
/// -
///
///
/// -
///
///
/// -
///
///
///
///
///
/// Implements to help 's implementation of the
/// interface ().
/// For now this information is not serialized, because most of it can be inferred at runtime on the client side, but
/// it might get used in the future.
///
private class GrabbableObjectAnchorInfo : IUxrSerializable
{
#region Public Types & Data
///
/// Gets or sets whether the given had a compatible
/// within a valid drop distance the last frame.
///
public bool HadCompatibleObjectNearLastFrame
{
get => _hadCompatibleObjectNearLastFrame;
set => _hadCompatibleObjectNearLastFrame = value;
}
///
/// Gets or sets whether the given has currently a compatible
/// within a valid drop distance.
///
public bool HasCompatibleObjectNear
{
get => _hasCompatibleObjectNear;
set => _hasCompatibleObjectNear = value;
}
///
/// Gets or sets the that currently can grab the placed on
/// the given . Null if there is none.
///
public UxrGrabber GrabberNear
{
get => _grabberNear;
set => _grabberNear = value;
}
///
/// Gets or sets the that could grab the placed on the
/// given during last frame. Null if there was none.
///
public UxrGrabber LastValidGrabberNear
{
get => _lastValidGrabberNear;
set => _lastValidGrabberNear = value;
}
///
/// Gets or sets the grab point index of the that is placed on the given
/// that can currently be grabbed by . -1 If there is
/// none.
///
public int GrabPointNear
{
get => _grabPointNear;
set => _grabPointNear = value;
}
///
/// Gets or sets the grab point index of the that is placed on the given
/// that could be grabbed by during last frame. -1
/// if there was none.
///
public int LastValidGrabPointNear
{
get => _lastValidGrabPointNear;
set => _lastValidGrabPointNear = value;
}
///
/// Gets or sets the that currently is grabbing an that can
/// be placed on the given . Null if there is none.
///
public UxrGrabber FullGrabberNear
{
get => _fullGrabberNear;
set => _fullGrabberNear = value;
}
///
/// Gets or sets the that currently is grabbing an that
/// could be placed on the given during last frame. Null if there was none.
///
public UxrGrabber LastFullGrabberNear
{
get => _lastFullGrabberNear;
set => _lastFullGrabberNear = value;
}
#endregion
#region Constructors & Finalizer
///
/// Default constructor required for serialization.
///
public GrabbableObjectAnchorInfo()
{
}
#endregion
#region Implicit IUxrSerializable
///
public int SerializationVersion => 0;
///
public void Serialize(IUxrSerializer serializer, int serializationVersion)
{
serializer.Serialize(ref _hadCompatibleObjectNearLastFrame);
serializer.Serialize(ref _hasCompatibleObjectNear);
serializer.SerializeUniqueComponent(ref _grabberNear);
serializer.SerializeUniqueComponent(ref _lastValidGrabberNear);
serializer.Serialize(ref _grabPointNear);
serializer.Serialize(ref _lastValidGrabPointNear);
serializer.SerializeUniqueComponent(ref _fullGrabberNear);
serializer.SerializeUniqueComponent(ref _lastFullGrabberNear);
}
#endregion
#region Private Types & Data
private bool _hadCompatibleObjectNearLastFrame;
private bool _hasCompatibleObjectNear;
private UxrGrabber _grabberNear;
private UxrGrabber _lastValidGrabberNear;
private int _grabPointNear = -1;
private int _lastValidGrabPointNear = -1;
private UxrGrabber _fullGrabberNear;
private UxrGrabber _lastFullGrabberNear;
#endregion
}
#endregion
}
}