tightening up component write logic
parent
bd17a86dec
commit
7029b9f52e
|
@ -58,14 +58,25 @@ namespace Encompass
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool RemoveImmediate<TComponent>(Entity entity, int priority) where TComponent : struct, IComponent
|
internal bool RemoveImmediate<TComponent>(Entity entity, int priority) where TComponent : struct, IComponent
|
||||||
|
{
|
||||||
|
if (immediateComponentStore.Remove<TComponent>(entity.ID, priority))
|
||||||
{
|
{
|
||||||
UpToDateComponentStore.Remove<TComponent>(entity.ID, priority);
|
UpToDateComponentStore.Remove<TComponent>(entity.ID, priority);
|
||||||
return immediateComponentStore.Remove<TComponent>(entity.ID, priority);
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool Remove<TComponent>(Entity entity, int priority) where TComponent : struct, IComponent
|
internal bool Remove<TComponent>(Entity entity, int priority) where TComponent : struct, IComponent
|
||||||
{
|
{
|
||||||
return UpToDateComponentStore.Remove<TComponent>(entity.ID, priority);
|
if (existingComponentStore.Remove<TComponent>(entity.ID, priority))
|
||||||
|
{
|
||||||
|
UpToDateComponentStore.Remove<TComponent>(entity.ID, priority);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegisterExistingOrImmediateComponentMessage<TComponent>(Entity entity, TComponent component) where TComponent : struct, IComponent
|
private void RegisterExistingOrImmediateComponentMessage<TComponent>(Entity entity, TComponent component) where TComponent : struct, IComponent
|
||||||
|
|
|
@ -47,9 +47,9 @@ namespace Encompass
|
||||||
CallGenericMethod(type, "GetComponent", new Type[] { typeof(Entity) }, new object[] { Entity });
|
CallGenericMethod(type, "GetComponent", new Type[] { typeof(Entity) }, new object[] { Entity });
|
||||||
CallGenericMethod(type, "HasComponent", new Type[] { typeof(Entity) }, new object[] { Entity });
|
CallGenericMethod(type, "HasComponent", new Type[] { typeof(Entity) }, new object[] { Entity });
|
||||||
CallGenericMethod(type, "SomeComponent", null);
|
CallGenericMethod(type, "SomeComponent", null);
|
||||||
CallGenericMethod(type, "RemoveComponent", new Type[] { typeof(Entity) }, new object[] { Entity });
|
|
||||||
CallGenericMethod(type, "DestroyWith", null);
|
CallGenericMethod(type, "DestroyWith", null);
|
||||||
CallGenericMethod(type, "DestroyAllWith", null);
|
CallGenericMethod(type, "DestroyAllWith", null);
|
||||||
|
CallGenericMethod(type, "RemoveComponent", new Type[] { typeof(Entity) }, new object[] { Entity });
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var type in _messageTypes)
|
foreach (var type in _messageTypes)
|
||||||
|
|
Loading…
Reference in New Issue