public void EntityUniqueId() { HashSet <int> ids = new HashSet <int>(); IGameSnapshot snapshot = LevelManager.CreateSnapshot(); for (int i = 0; i < 200; ++i) { IEntity entity = snapshot.CreateEntity(); Assert.True(ids.Add(entity.UniqueId)); } }
public void RemodifyCurrentData() { IGameSnapshot snapshot = LevelManager.CreateSnapshot(); IEntity entity = snapshot.CreateEntity(); entity.AddData <DataConcurrentNonVersioned>(); entity.AddData <DataConcurrentVersioned>(); snapshot.Systems.Add(new DoubleModifySystem()); ITemplateGroup templates = LevelManager.CreateTemplateGroup(); IGameEngine engine = GameEngineFactory.CreateEngine(snapshot, templates).Value; for (int i = 0; i < 20; ++i) { engine.Update().Wait(); engine.SynchronizeState().Wait(); } }
public TestEntityBuilder NewEntity() { return(new TestEntityBuilder(Snapshot.CreateEntity())); }