clear entity sets on snapshot
							parent
							
								
									0551aa0a07
								
							
						
					
					
						commit
						95b38cb092
					
				| 
						 | 
					@ -59,10 +59,14 @@ public class Snapshot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// restore entity relation index state
 | 
							// restore entity relation index state
 | 
				
			||||||
		// FIXME: arghhhh this is so slow
 | 
							// FIXME: arghhhh this is so slow
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							foreach (var (id, relationTypeSet) in world.EntityRelationIndex)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								relationTypeSet.Clear();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		foreach (var (id, relationTypeSet) in EntityRelationIndex)
 | 
							foreach (var (id, relationTypeSet) in EntityRelationIndex)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			world.EntityRelationIndex[id].Clear();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			foreach (var typeId in relationTypeSet)
 | 
								foreach (var typeId in relationTypeSet)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				world.EntityRelationIndex[id].Add(typeId);
 | 
									world.EntityRelationIndex[id].Add(typeId);
 | 
				
			||||||
| 
						 | 
					@ -71,10 +75,14 @@ public class Snapshot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// restore entity component index state
 | 
							// restore entity component index state
 | 
				
			||||||
		// FIXME: arrghghhh this is so slow
 | 
							// FIXME: arrghghhh this is so slow
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							foreach (var (id, componentTypeSet) in world.EntityComponentIndex)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								componentTypeSet.Clear();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		foreach (var (id, componentTypeSet) in EntityComponentIndex)
 | 
							foreach (var (id, componentTypeSet) in EntityComponentIndex)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			world.EntityComponentIndex[id].Clear();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			foreach (var typeId in componentTypeSet)
 | 
								foreach (var typeId in componentTypeSet)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				world.EntityComponentIndex[id].Add(typeId);
 | 
									world.EntityComponentIndex[id].Add(typeId);
 | 
				
			||||||
| 
						 | 
					@ -192,7 +200,6 @@ public class Snapshot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private class ComponentSnapshot
 | 
						private class ComponentSnapshot
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		private readonly Dictionary<Entity, int> EntityIDToStorageIndex = new Dictionary<Entity, int>();
 | 
					 | 
				
			||||||
		private readonly NativeArray Components;
 | 
							private readonly NativeArray Components;
 | 
				
			||||||
		private readonly NativeArray<Entity> EntityIDs;
 | 
							private readonly NativeArray<Entity> EntityIDs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue