PrepareTransferTo method to speed up transfers
parent
2aa8fc87e7
commit
855b8d6487
12
src/World.cs
12
src/World.cs
|
@ -145,6 +145,14 @@ namespace MoonTools.ECS
|
|||
|
||||
private Dictionary<int, int> WorldToTransferID = new Dictionary<int, int>();
|
||||
|
||||
/// <summary>
|
||||
/// If you are using the World Transfer feature, call this once after your systems/filters have all been initialized.
|
||||
/// </summary>
|
||||
public void PrepareTransferTo(World other)
|
||||
{
|
||||
other.FilterStorage.CreateMissingStorages(FilterStorage);
|
||||
}
|
||||
|
||||
// FIXME: there's probably a better way to handle Filters so they are not world-bound
|
||||
public unsafe void Transfer(World other, Filter filter, Filter otherFilter)
|
||||
{
|
||||
|
@ -152,10 +160,6 @@ namespace MoonTools.ECS
|
|||
other.ComponentDepot.CreateMissingStorages(ComponentDepot);
|
||||
other.RelationDepot.CreateMissingStorages(RelationDepot);
|
||||
|
||||
// FIXME: we could just do this once on startup
|
||||
// Could have a PrepareTransfer method or something
|
||||
other.FilterStorage.CreateMissingStorages(FilterStorage);
|
||||
|
||||
// destroy all entities matching the filter
|
||||
foreach (var entity in otherFilter.Entities)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue