Commit Description:
Make sound preview use the new volume....
Commit Description:
Make sound preview use the new volume. Plays the sound at the new volume, not the old volume. Uses nullables, which I'm a little unsure of how well they'll work out in practice. I think this is a reasonable place to experiment.
Show/Diff file:
Action:
encompass-cs/encompass-cs/Renderer.cs
56 lines | 1.9 KiB | text/x-csharp | CSharpLexer
using System;
using System.Collections.Generic;
namespace Encompass
{
public abstract class Renderer
{
internal EntityManager _entityManager;
internal ComponentManager _componentManager;
internal void AssignEntityManager(EntityManager entityManager)
{
_entityManager = entityManager;
}
internal void AssignComponentManager(ComponentManager componentManager)
{
_componentManager = componentManager;
}
protected Span<Entity> ReadEntities<TComponent>() where TComponent : struct, IComponent
{
return _componentManager.GetExistingEntities<TComponent>();
}
protected ref readonly Entity ReadEntity<TComponent>() where TComponent : struct, IComponent
{
return ref _componentManager.ExistingSingularEntity<TComponent>();
}
protected Span<TComponent> ReadComponents<TComponent>() where TComponent : struct, IComponent
{
return _componentManager.GetComponentsByType<TComponent>();
}
protected ref readonly TComponent ReadComponent<TComponent>() where TComponent : struct, IComponent
{
return ref _componentManager.ExistingSingular<TComponent>();
}
protected ref readonly TComponent GetComponent<TComponent>(Entity entity) where TComponent : struct, IComponent
{
return ref _componentManager.GetComponentByEntityAndType<TComponent>(entity.ID);
}
protected bool HasComponent<TComponent>(Entity entity) where TComponent : struct, IComponent
{
return _componentManager.EntityHasComponentOfType<TComponent>(entity.ID);
}
protected bool SomeComponent<TComponent>() where TComponent : struct, IComponent
{
return _componentManager.SomeExistingComponent<TComponent>();
}
}
}