Keeps a list of all active entities and manages all behaviors for entities. Updating is done
at a fixed time step (e.g. 0.1). Drawing has read-only access, it runs as quickly as possible
(60fps+). Details: http://gafferongames.com/game-physics/fix-your-timestep/
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Entities EntitiesRunner
DeltaEngine.Mocks MockEntitiesRunner
Namespace: DeltaEngine.Entities
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The EntitiesRunner type exposes the following members.
Constructors
Name | Description | |
---|---|---|
EntitiesRunner | Initializes a new instance of the EntitiesRunner class |
Methods
Name | Description | |
---|---|---|
ChangeUpdateTimeStep |
Changes how many times UpdateBehaviors and Updateables are called each second. By default
this setting is initialized at the beginning from Settings (20 UpdatesPerSecond = 0.05).
View code on GitHub | |
Dispose | Releases all resources used by the EntitiesRunner | |
GetAllEntities | ||
GetDrawBehavior T | ||
GetEntitiesOfType T | ||
GetEntitiesWithTag | ||
GetUpdateBehavior T | ||
GetWhetherAppIsPaused | ||
RemoveAll | ||
UpdateAndDrawAllEntities |
Properties
Name | Description | |
---|---|---|
Current | ||
NumberOfEntities | ||
State | ||
UpdateTimeStep |
Remarks
Examples
[Test] public void EntityIsCreatedActiveAndAutomaticallyAddedToEntitySystem() { var entity = new MockEntity(); Assert.IsTrue(entity.IsActive); Assert.AreEqual(1, EntitiesRunner.Current.NumberOfEntities); }
[Test] public void TestExceptions() { var settings = new MockSettings { UpdatesPerSecond = 0 }; Assert.Throws<EntitiesRunner.InvalidUpdatePerSecondSettings>( () => new EntitiesRunner(new MockBehaviorResolver(), settings)); Assert.Throws<EntitiesRunner.InvalidUpdatePerSecondSettings>( () => EntitiesRunner.Current.ChangeUpdateTimeStep(0)); Assert.Throws<EntitiesRunner.YouAreNotAllowedToDrawOutsideOfTheDrawLoop>( () => EntitiesRunner.Current.CheckIfInDrawState()); Assert.Throws<EntitiesRunner.UnableToResolveBehavior>( () => EntitiesRunner.Current.GetDrawBehavior<DrawBehavior>()); }
[Test] public void MockBehaviorResolversUpdateAndDrawAreNull() { Assert.AreEqual(null, new MockBehaviorResolver().ResolveUpdateBehavior(typeof(DerivedBehavior))); Assert.AreEqual(null, new MockBehaviorResolver().ResolveDrawBehavior(typeof(DerivedBehavior))); }
See Also