fix issue with reading pending component

pull/5/head
Evan Hemsley 2019-08-10 18:17:52 -07:00
parent df27c78e02
commit 1ce6e0e907
1 changed files with 12 additions and 1 deletions

View File

@ -222,9 +222,20 @@ namespace Encompass
var pendingRead = receiveTypes.Contains(typeof(PendingComponentMessage<TComponent>)); var pendingRead = receiveTypes.Contains(typeof(PendingComponentMessage<TComponent>));
var existingRead = receiveTypes.Contains(typeof(ComponentMessage<TComponent>)); var existingRead = receiveTypes.Contains(typeof(ComponentMessage<TComponent>));
if (existingRead && pendingRead) if (existingRead && pendingRead)
{
if (componentMessageManager.HasPendingComponent<TComponent>(entity))
{ {
return componentMessageManager.ReadPendingComponentByEntityAndType<TComponent>(entity); return componentMessageManager.ReadPendingComponentByEntityAndType<TComponent>(entity);
} }
else if (componentMessageManager.HasExistingComponent<TComponent>(entity))
{
return componentMessageManager.ReadExistingComponentByEntityAndType<TComponent>(entity);
}
else
{
throw new NoComponentOfTypeOnEntityException("No Component of type {0} exists on Entity {1}", typeof(TComponent).Name, entity.ID);
}
}
else if (existingRead) else if (existingRead)
{ {
return componentMessageManager.ReadExistingComponentByEntityAndType<TComponent>(entity); return componentMessageManager.ReadExistingComponentByEntityAndType<TComponent>(entity);