encompass-cs/encompass-cs/DebugRenderer.cs

34 lines
1.1 KiB
C#

#if DEBUG
using System;
using System.Collections.Generic;
namespace Encompass
{
public abstract class DebugRenderer : Renderer
{
protected IEnumerable<object> Debug_GetAllComponents(Entity entity)
{
return _componentManager.Debug_Components(entity.ID);
}
protected IEnumerable<Entity> Debug_Entities(Type componentType)
{
var method = typeof(Renderer).GetMethod(nameof(ReadEntitiesAsEnumerable), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var generic = method.MakeGenericMethod(componentType);
return (IEnumerable<Entity>)generic.Invoke(this, null);
}
protected IEnumerable<Type> Debug_SearchComponentType(string typeString)
{
return _componentManager.Debug_SearchComponentType(typeString);
}
protected void Debug_SetComponent<TComponent>(in Entity entity, in TComponent component) where TComponent : struct
{
_componentManager.Debug_UpdateComponent(entity.ID, component);
}
}
}
#endif