fix componentmessage self-cycle and rename WorldBuilder.EmitMessage
parent
42a9934d65
commit
80effc06dc
|
@ -40,7 +40,7 @@ namespace Encompass
|
|||
return entityManager.CreateEntity();
|
||||
}
|
||||
|
||||
public void EmitMessage<TMessage>(TMessage message) where TMessage : struct, IMessage
|
||||
public void SendMessage<TMessage>(TMessage message) where TMessage : struct, IMessage
|
||||
{
|
||||
messageManager.AddMessage(message);
|
||||
}
|
||||
|
@ -155,7 +155,10 @@ namespace Encompass
|
|||
{
|
||||
foreach (var readerEngine in typeToReaders[messageType])
|
||||
{
|
||||
engineGraph.AddEdge(senderEngine, readerEngine);
|
||||
if (senderEngine != readerEngine)
|
||||
{
|
||||
engineGraph.AddEdge(senderEngine, readerEngine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace Tests
|
|||
AddComponentTestMessage addComponentTestMessage;
|
||||
addComponentTestMessage.entity = entity;
|
||||
addComponentTestMessage.mockComponent = mockComponent;
|
||||
worldBuilder.EmitMessage(addComponentTestMessage);
|
||||
worldBuilder.SendMessage(addComponentTestMessage);
|
||||
|
||||
var world = worldBuilder.Build();
|
||||
|
||||
|
@ -227,7 +227,7 @@ namespace Tests
|
|||
|
||||
EntityMessage entityMessage;
|
||||
entityMessage.entity = entity;
|
||||
worldBuilder.EmitMessage(entityMessage);
|
||||
worldBuilder.SendMessage(entityMessage);
|
||||
|
||||
var world = worldBuilder.Build();
|
||||
|
||||
|
@ -250,7 +250,7 @@ namespace Tests
|
|||
|
||||
EntityMessage entityMessage;
|
||||
entityMessage.entity = entity;
|
||||
worldBuilder.EmitMessage(entityMessage);
|
||||
worldBuilder.SendMessage(entityMessage);
|
||||
|
||||
var world = worldBuilder.Build();
|
||||
|
||||
|
@ -292,7 +292,7 @@ namespace Tests
|
|||
|
||||
HasComponentTestMessage hasComponentTestMessage;
|
||||
hasComponentTestMessage.entity = entity;
|
||||
worldBuilder.EmitMessage(hasComponentTestMessage);
|
||||
worldBuilder.SendMessage(hasComponentTestMessage);
|
||||
|
||||
var world = worldBuilder.Build();
|
||||
|
||||
|
@ -331,7 +331,7 @@ namespace Tests
|
|||
|
||||
HasComponentWhenInactiveTestMessage testMessage;
|
||||
testMessage.entity = entity;
|
||||
worldBuilder.EmitMessage(testMessage);
|
||||
worldBuilder.SendMessage(testMessage);
|
||||
|
||||
worldBuilder.DeactivateComponent(componentID);
|
||||
|
||||
|
@ -407,7 +407,7 @@ namespace Tests
|
|||
RemoveComponentTestMessage removeComponentMessage;
|
||||
removeComponentMessage.entity = entity;
|
||||
removeComponentMessage.componentID = componentID;
|
||||
worldBuilder.EmitMessage(removeComponentMessage);
|
||||
worldBuilder.SendMessage(removeComponentMessage);
|
||||
|
||||
var world = worldBuilder.Build();
|
||||
|
||||
|
@ -495,7 +495,7 @@ namespace Tests
|
|||
ActivateComponentMessage activateMessage;
|
||||
activateMessage.entity = entity;
|
||||
activateMessage.componentID = componentID;
|
||||
worldBuilder.EmitMessage(activateMessage);
|
||||
worldBuilder.SendMessage(activateMessage);
|
||||
|
||||
var world = worldBuilder.Build();
|
||||
|
||||
|
@ -569,7 +569,7 @@ namespace Tests
|
|||
DeactivateComponentMessage deactivateComponentMessage;
|
||||
deactivateComponentMessage.entity = entity;
|
||||
deactivateComponentMessage.componentID = componentID;
|
||||
worldBuilder.EmitMessage(deactivateComponentMessage);
|
||||
worldBuilder.SendMessage(deactivateComponentMessage);
|
||||
|
||||
var world = worldBuilder.Build();
|
||||
|
||||
|
|
|
@ -697,7 +697,7 @@ namespace Tests
|
|||
MockComponentUpdateMessage mockComponentUpdateMessage;
|
||||
mockComponentUpdateMessage.componentID = mockComponentID;
|
||||
mockComponentUpdateMessage.mockComponent = mockComponent;
|
||||
worldBuilder.EmitMessage(mockComponentUpdateMessage);
|
||||
worldBuilder.SendMessage(mockComponentUpdateMessage);
|
||||
|
||||
var world = worldBuilder.Build();
|
||||
Assert.Throws<RepeatUpdateComponentException>(() => world.Update(0.01));
|
||||
|
|
Loading…
Reference in New Issue