2019-06-15 00:51:06 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
2019-06-16 01:05:56 +00:00
|
|
|
namespace Encompass
|
|
|
|
{
|
|
|
|
public class World
|
|
|
|
{
|
2019-06-20 17:46:15 +00:00
|
|
|
private readonly List<Engine> enginesInOrder;
|
|
|
|
private readonly EntityManager entityManager;
|
|
|
|
private readonly ComponentManager componentManager;
|
|
|
|
private readonly MessageManager messageManager;
|
|
|
|
private readonly RenderManager renderManager;
|
2019-06-14 03:28:26 +00:00
|
|
|
|
2019-06-15 00:51:06 +00:00
|
|
|
internal World(
|
2019-06-17 00:56:36 +00:00
|
|
|
List<Engine> enginesInOrder,
|
2019-06-15 00:51:06 +00:00
|
|
|
EntityManager entityManager,
|
2019-06-16 01:55:35 +00:00
|
|
|
ComponentManager componentManager,
|
2019-06-19 21:14:44 +00:00
|
|
|
MessageManager messageManager,
|
|
|
|
RenderManager renderManager
|
2019-06-16 01:05:56 +00:00
|
|
|
)
|
|
|
|
{
|
2019-06-17 00:56:36 +00:00
|
|
|
this.enginesInOrder = enginesInOrder;
|
2019-06-15 00:03:56 +00:00
|
|
|
this.entityManager = entityManager;
|
|
|
|
this.componentManager = componentManager;
|
2019-06-16 01:55:35 +00:00
|
|
|
this.messageManager = messageManager;
|
2019-06-19 21:14:44 +00:00
|
|
|
this.renderManager = renderManager;
|
2019-06-14 03:28:26 +00:00
|
|
|
}
|
|
|
|
|
2019-06-16 01:05:56 +00:00
|
|
|
public void Update(float dt)
|
|
|
|
{
|
2019-06-17 00:56:36 +00:00
|
|
|
foreach (var engine in enginesInOrder)
|
2019-06-16 01:05:56 +00:00
|
|
|
{
|
2019-06-15 00:51:06 +00:00
|
|
|
engine.Update(dt);
|
|
|
|
}
|
|
|
|
|
2019-06-16 01:55:35 +00:00
|
|
|
messageManager.ClearMessages();
|
2019-06-14 05:25:05 +00:00
|
|
|
entityManager.DestroyMarkedEntities();
|
2019-06-19 23:13:02 +00:00
|
|
|
|
2019-06-20 00:40:01 +00:00
|
|
|
componentManager.ActivateMarkedComponents();
|
|
|
|
componentManager.DeactivateMarkedComponents();
|
|
|
|
componentManager.RemoveMarkedComponents();
|
2019-06-19 23:13:02 +00:00
|
|
|
|
|
|
|
entityManager.CheckEntitiesWithAddedComponents();
|
|
|
|
entityManager.CheckEntitiesWithRemovedComponents();
|
2019-06-14 03:28:26 +00:00
|
|
|
}
|
2019-06-19 21:14:44 +00:00
|
|
|
|
|
|
|
public void Draw()
|
|
|
|
{
|
|
|
|
renderManager.Draw();
|
|
|
|
}
|
2019-06-14 03:28:26 +00:00
|
|
|
}
|
|
|
|
}
|