rename Subject to Aspect

This commit is contained in:
Mikhail 2023-06-22 14:30:03 +08:00
parent 4e17385e30
commit e728cacfc9
2 changed files with 8 additions and 8 deletions

View File

@ -5,10 +5,10 @@ namespace DCFApixels.DragonECS
{
public class EcsEntityConnect : MonoBehaviour
{
private sealed class Subject : EcsSubject
private sealed class Aspect : EcsAspect
{
public readonly EcsPool<UnityGameObject> unityGameObjects;
public Subject(Builder b)
public Aspect(Builder b)
{
unityGameObjects = b.Include<UnityGameObject>();
}
@ -49,7 +49,7 @@ namespace DCFApixels.DragonECS
{
if(_entity.TryGetID(out int oldE) && _world != null)
{
var s = _world.GetSubject<Subject>();
var s = _world.GetAspect<Aspect>();
s.unityGameObjects.Del(oldE);
}
_world = null;
@ -58,7 +58,7 @@ namespace DCFApixels.DragonECS
{
_entity = entity;
_world = _entity.World;
var s = _world.GetSubject<Subject>();
var s = _world.GetAspect<Aspect>();
if (!s.unityGameObjects.Has(newE)) s.unityGameObjects.Add(newE) = new UnityGameObject(gameObject);
if (applyTemplates)

View File

@ -7,10 +7,10 @@ namespace DCFApixels.DragonECS
public class DeleteOneFrameComponentFixedSystem<TComponent> : IEcsFixedRunProcess, IEcsInject<EcsWorld>
where TComponent : struct, IEcsComponent
{
private sealed class Subject : EcsSubject
private sealed class Aspect : EcsAspect
{
public EcsPool<TComponent> pool;
public Subject(Builder b) => pool = b.Include<TComponent>();
public Aspect(Builder b) => pool = b.Include<TComponent>();
}
List<EcsWorld> _worlds = new List<EcsWorld>();
public void Inject(EcsWorld obj) => _worlds.Add(obj);
@ -21,8 +21,8 @@ namespace DCFApixels.DragonECS
EcsWorld world = _worlds[i];
if (world.IsComponentTypeDeclared<TComponent>())
{
foreach (var e in world.Where(out Subject s))
s.pool.Del(e);
foreach (var e in world.Where(out Aspect a))
a.pool.Del(e);
}
}
}