using System;
using UnityEngine.SubsystemsImplementation;
namespace UnityEngine.XR.ARSubsystems
{
///
/// Describes the capabilities of an .
///
[Obsolete("XRReferencePointSubsystemDescriptor has been deprecated. Use XRAnchorSubsystemDescriptor instead (UnityUpgradable) -> UnityEngine.XR.ARSubsystems.XRAnchorSubsystemDescriptor", false)]
public class XRReferencePointSubsystemDescriptor
: SubsystemDescriptorWithProvider
{
///
/// true if the subsystem supports attachments (that is, the ability to attach a reference point to a trackable).
///
public bool supportsTrackableAttachments { get; private set; }
///
/// Constructor info used to register a descriptor.
///
public struct Cinfo : IEquatable
{
///
/// The string identifier for this subsystem.
///
public string id { get; set; }
///
/// Specifies the provider implementation type to use for instantiation.
///
///
/// The provider implementation type to use for instantiation.
///
public Type providerType { get; set; }
///
/// Specifies the XRReferencePointSubsystem-derived type that forwards casted calls to its provider.
///
///
/// The type of the subsystem to use for instantiation. If null, XRAnchorSubsystem will be instantiated.
///
public Type subsystemTypeOverride { get; set; }
///
/// The concrete Type of the subsystem which will be instantiated if a subsystem is created from this descriptor.
///
[Obsolete("XRReferencePointSubsystem no longer supports the deprecated set of base classes for subsystems as of Unity 2020.2. Use providerType and, optionally, subsystemTypeOverride instead.", true)]
public Type subsystemImplementationType { get; set; }
///
/// true if the subsystem supports attachments (that is, the ability to attach a reference point to a trackable).
///
public bool supportsTrackableAttachments { get; set; }
///
/// Generates a hash suitable for use with containers like `HashSet` and `Dictionary`.
///
/// A hash code generated from this object's fields.
public override int GetHashCode()
{
unchecked
{
int hash = HashCodeUtil.ReferenceHash(id);
hash = hash * 486187739 + HashCodeUtil.ReferenceHash(providerType);
hash = hash * 486187739 + HashCodeUtil.ReferenceHash(subsystemTypeOverride);
return hash;
}
}
///
/// Tests for equality.
///
/// The `object` to compare against.
/// `True` if is of type and
/// also returns `true`; otherwise `false`.
public override bool Equals(object obj)
{
if (!(obj is Cinfo))
return false;
return Equals((Cinfo)obj);
}
///
/// Tests for equality.
///
/// The other to compare against.
/// `True` if every field in is equal to this , otherwise false.
public bool Equals(Cinfo other)
{
return
String.Equals(id, other.id) &&
ReferenceEquals(providerType, other.providerType) &&
ReferenceEquals(subsystemTypeOverride, other.subsystemTypeOverride);
}
///
/// Tests for equality. Same as .
///
/// The left-hand side of the comparison.
/// The right-hand side of the comparison.
/// `True` if is equal to , otherwise `false`.
public static bool operator ==(Cinfo lhs, Cinfo rhs) => lhs.Equals(rhs);
///
/// Tests for inequality. Same as `!`.
///
/// The left-hand side of the comparison.
/// The right-hand side of the comparison.
/// `True` if is not equal to , otherwise `false`.
public static bool operator !=(Cinfo lhs, Cinfo rhs) => !lhs.Equals(rhs);
}
///
/// Creates a new subsystem descriptor and registers it with the SubsystemManager.
///
/// Constructor info describing the descriptor to create.
public static void Create(Cinfo cinfo)
{
SubsystemDescriptorStore.RegisterDescriptor(new XRReferencePointSubsystemDescriptor(cinfo));
}
XRReferencePointSubsystemDescriptor(Cinfo cinfo)
{
id = cinfo.id;
providerType = cinfo.providerType;
subsystemTypeOverride = cinfo.subsystemTypeOverride;
supportsTrackableAttachments = cinfo.supportsTrackableAttachments;
}
}
}