namespace GlitchyEngine.Core;
///
/// Represents a universally unique identifier (UUID).
///
public struct UUID
{
private ulong _uuid;
///
/// Create a new instance of a with the given value as ID.
///
/// The id.
public UUID(ulong uuid)
{
_uuid = uuid;
}
///
/// A with the ID 0.
///
public static readonly UUID Zero = new UUID(0);
///
/// Creates a new random .
///
/// The newly created
public static UUID CreateNew()
{
ScriptGlue.UUID_CreateNew(out UUID id);
return id;
}
public static bool operator ==(UUID left, UUID right) => left._uuid == right._uuid;
public static bool operator !=(UUID left, UUID right) => left._uuid != right._uuid;
public override bool Equals(object obj)
{
if (obj is UUID other)
{
return this == other;
}
return false;
}
public override int GetHashCode()
{
return _uuid.GetHashCode();
}
public override string ToString()
{
return _uuid.ToString();
}
}