using Gallium;
namespace Nitride.Contents
{
///
/// Various extension methods for working with binary content.
///
public static class EntityBinaryContentExtensions
{
///
/// Retrieves the binary content associated with this entity.
///
/// The entity to query.
/// The binary content.
public static IBinaryContent GetBinaryContent(this Entity entity)
{
return entity.Get();
}
///
/// Determines if the entity has a registered IBinaryContent component.
///
/// The entity to inspect.
/// True if there is a component extending `IContent`.
public static bool HasBinaryContent(this Entity entity)
{
return entity.Has();
}
///
/// Remove all existing content components from the entity and then adds
/// the new binary content as a component into the entity before
/// returning it.
///
/// The entity to query and modify.
/// The content to add to the entity.
/// The base type of the content.
/// The entity or a copy with the new component.
public static Entity SetBinaryContent(
this Entity entity,
TType content)
where TType : IBinaryContent
{
return entity.SetContent(content);
}
}
}