mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 18:14:35 +08:00
rename Subject to Aspect
This commit is contained in:
parent
4e17385e30
commit
e728cacfc9
@ -5,10 +5,10 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
public class EcsEntityConnect : MonoBehaviour
|
public class EcsEntityConnect : MonoBehaviour
|
||||||
{
|
{
|
||||||
private sealed class Subject : EcsSubject
|
private sealed class Aspect : EcsAspect
|
||||||
{
|
{
|
||||||
public readonly EcsPool<UnityGameObject> unityGameObjects;
|
public readonly EcsPool<UnityGameObject> unityGameObjects;
|
||||||
public Subject(Builder b)
|
public Aspect(Builder b)
|
||||||
{
|
{
|
||||||
unityGameObjects = b.Include<UnityGameObject>();
|
unityGameObjects = b.Include<UnityGameObject>();
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
if(_entity.TryGetID(out int oldE) && _world != null)
|
if(_entity.TryGetID(out int oldE) && _world != null)
|
||||||
{
|
{
|
||||||
var s = _world.GetSubject<Subject>();
|
var s = _world.GetAspect<Aspect>();
|
||||||
s.unityGameObjects.Del(oldE);
|
s.unityGameObjects.Del(oldE);
|
||||||
}
|
}
|
||||||
_world = null;
|
_world = null;
|
||||||
@ -58,7 +58,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
_entity = entity;
|
_entity = entity;
|
||||||
_world = _entity.World;
|
_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 (!s.unityGameObjects.Has(newE)) s.unityGameObjects.Add(newE) = new UnityGameObject(gameObject);
|
||||||
|
|
||||||
if (applyTemplates)
|
if (applyTemplates)
|
||||||
|
@ -7,10 +7,10 @@ namespace DCFApixels.DragonECS
|
|||||||
public class DeleteOneFrameComponentFixedSystem<TComponent> : IEcsFixedRunProcess, IEcsInject<EcsWorld>
|
public class DeleteOneFrameComponentFixedSystem<TComponent> : IEcsFixedRunProcess, IEcsInject<EcsWorld>
|
||||||
where TComponent : struct, IEcsComponent
|
where TComponent : struct, IEcsComponent
|
||||||
{
|
{
|
||||||
private sealed class Subject : EcsSubject
|
private sealed class Aspect : EcsAspect
|
||||||
{
|
{
|
||||||
public EcsPool<TComponent> pool;
|
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>();
|
List<EcsWorld> _worlds = new List<EcsWorld>();
|
||||||
public void Inject(EcsWorld obj) => _worlds.Add(obj);
|
public void Inject(EcsWorld obj) => _worlds.Add(obj);
|
||||||
@ -21,8 +21,8 @@ namespace DCFApixels.DragonECS
|
|||||||
EcsWorld world = _worlds[i];
|
EcsWorld world = _worlds[i];
|
||||||
if (world.IsComponentTypeDeclared<TComponent>())
|
if (world.IsComponentTypeDeclared<TComponent>())
|
||||||
{
|
{
|
||||||
foreach (var e in world.Where(out Subject s))
|
foreach (var e in world.Where(out Aspect a))
|
||||||
s.pool.Del(e);
|
a.pool.Del(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user