56 lines
1.6 KiB
C#
56 lines
1.6 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace Encompass
|
|
{
|
|
internal class MessageManager
|
|
{
|
|
private readonly TimeManager timeManager;
|
|
private readonly MessageStore messageStore = new MessageStore();
|
|
|
|
public MessageManager(TimeManager timeManager)
|
|
{
|
|
this.timeManager = timeManager;
|
|
}
|
|
|
|
internal void AddMessage<TMessage>(TMessage message) where TMessage : struct, IMessage
|
|
{
|
|
messageStore.AddMessage<TMessage>(message);
|
|
}
|
|
|
|
internal void AddMessage<TMessage>(TMessage message, double time) where TMessage : struct, IMessage
|
|
{
|
|
messageStore.AddMessage(message, time);
|
|
}
|
|
|
|
internal void AddMessageIgnoringTimeDilation<TMessage>(TMessage message, double time) where TMessage : struct, IMessage
|
|
{
|
|
messageStore.AddMessageIgnoringTimeDilation(message, time);
|
|
}
|
|
|
|
internal void ClearMessages()
|
|
{
|
|
messageStore.ClearAll();
|
|
}
|
|
|
|
internal void ProcessDelayedMessages(double dt)
|
|
{
|
|
messageStore.ProcessDelayedMessages(dt * timeManager.TimeDilationFactor, dt);
|
|
}
|
|
|
|
internal IEnumerable<TMessage> GetMessagesByType<TMessage>() where TMessage : struct, IMessage
|
|
{
|
|
return messageStore.All<TMessage>();
|
|
}
|
|
|
|
internal bool Any<TMessage>() where TMessage : struct, IMessage
|
|
{
|
|
return messageStore.Any<TMessage>();
|
|
}
|
|
|
|
internal TMessage First<TMessage>() where TMessage : struct, IMessage
|
|
{
|
|
return messageStore.First<TMessage>();
|
|
}
|
|
}
|
|
}
|