add singular ReadMessage to System
parent
82271e6b13
commit
8ec2780356
|
@ -24,11 +24,16 @@ internal class MessageDepot
|
|||
return Lookup<TMessage>().Some();
|
||||
}
|
||||
|
||||
public ReadOnlySpan<TMessage> Read<TMessage>() where TMessage : struct
|
||||
public ReadOnlySpan<TMessage> ReadAll<TMessage>() where TMessage : struct
|
||||
{
|
||||
return Lookup<TMessage>().All();
|
||||
}
|
||||
|
||||
public TMessage ReadFirst<TMessage>() where TMessage : struct
|
||||
{
|
||||
return Lookup<TMessage>().First();
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
foreach (var storage in storages.Values)
|
||||
|
|
|
@ -38,6 +38,11 @@ internal class MessageStorage<TMessage> : MessageStorage where TMessage : struct
|
|||
return new ReadOnlySpan<TMessage>(messages, 0, count);
|
||||
}
|
||||
|
||||
public TMessage First()
|
||||
{
|
||||
return messages[0];
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
count = 0;
|
||||
|
|
|
@ -38,7 +38,12 @@ public abstract class System : EntityComponentReader
|
|||
|
||||
protected ReadOnlySpan<TMessage> ReadMessages<TMessage>() where TMessage : struct
|
||||
{
|
||||
return MessageDepot.Read<TMessage>();
|
||||
return MessageDepot.ReadAll<TMessage>();
|
||||
}
|
||||
|
||||
protected TMessage ReadMessage<TMessage>() where TMessage : struct
|
||||
{
|
||||
return MessageDepot.ReadFirst<TMessage>();
|
||||
}
|
||||
|
||||
protected bool SomeMessage<TMessage>() where TMessage : struct
|
||||
|
|
Loading…
Reference in New Issue