Each entity has a name, unique components for data and behaviors for logic attached to them.
Entities are used for all engine objects, rendering, game objects, ui, physics, etc.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Entities Entity
Asteroids InteractionLogic
Blocks Block
Blocks Controller
Breakout UI
CreepyTowers.Avatars Avatar
CreepyTowers.Enemy.Creeps WaveGenerator
CreepyTowers Game
CreepyTowers GameCamera
CreepyTowers Player
CreepyTowers.Tests MockGame
CreepyTowers.Towers TowerTargetFinder
DeltaEngine.Commands Command
DeltaEngine.Commands Trigger
DeltaEngine.Editor.UIEditor ControlTransformer MouseCursor
DeltaEngine.Entities DrawableEntity
DeltaEngine.Mocks MockEntity
DeltaEngine.Mocks MockNonPauseableEntity
DeltaEngine.Mocks MockNonPauseableRapidEntity
DeltaEngine.Mocks MockRapidEntity
DeltaEngine.Multimedia SoundDevice
DeltaEngine.Physics2D Physics
DeltaEngine.Physics3D Physics
DeltaEngine.Rendering3D.Cameras Camera
DeltaEngine.Scenes.EntityDebugger EntityEditor
Drench DrenchMenu
Drench.Games Game
EmptyApp ColorChanger
FractalZoomer Zoomer
GameOfDeath GameOfDeath
GhostWars GhostWave
GhostWars MainMenu
GhostWars TreeManager
Physics2DDemo Game
Physics3DDemo Game
SideScroller InteractionLogics
SideScroller ParallaxBackground
Namespace: DeltaEngine.Entities
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The Entity type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Entity |
Entities start out active and are automatically added to the current EntitiesRunner. Call
IsActive to activate or deactivate one. To disable UpdateBehaviors use Stop T View code on GitHub |
Methods
Name | Description | |
---|---|---|
Add T | ||
AddTag | ||
ClearTags | ||
Contains T | ||
ContainsBehavior T | ||
ContainsTag | ||
Deactivate | ||
Dispose | ||
Get T |
Gets a specific component, derived classes can return faster cached values (e.g. Entity2D)
View code on GitHub | |
GetActiveBehaviors | ||
GetComponentsForSaving | ||
GetOrDefault T | ||
GetTags | ||
Remove T | ||
RemoveTag | ||
Set | ||
SetComponents | ||
Start T | ||
Stop T | ||
ToString | (Overrides Object ToString .) |
Fields
Name | Description | |
---|---|---|
components |
Properties
Name | Description | |
---|---|---|
IsActive | ||
IsPauseable | ||
NumberOfComponents | ||
UpdatePriority |
Remarks
Examples
[Test] public void DeactivateAndActivateEntity() { entityWithTags.Start<MockUpdateBehavior>(); entityWithTags.IsActive = false; Assert.IsFalse(entityWithTags.IsActive); Assert.AreEqual(0, entities.GetEntitiesOfType<MockEntity>().Count); entityWithTags.IsActive = true; Assert.IsTrue(entityWithTags.IsActive); Assert.IsTrue(entityWithTags.ContainsBehavior<MockUpdateBehavior>()); Assert.AreEqual(1, entities.GetEntitiesOfType<MockEntity>().Count); }
[Test] public void CheckNameAndDefaultValues() { Assert.AreEqual(0, entityWithTags.NumberOfComponents); Assert.IsTrue(entityWithTags.IsActive); }
[Test] public void AddAndRemoveComponent() { Assert.AreEqual(1, entities.NumberOfEntities); var entity = new MockEntity().Add(new object()); Assert.AreEqual(2, entities.NumberOfEntities); Assert.AreEqual(1, entity.NumberOfComponents); Assert.IsNotNull(entity.Get<object>()); entity.Remove<object>(); Assert.AreEqual(0, entity.NumberOfComponents); Assert.IsFalse(entity.Contains<object>()); Assert.Throws<ArgumentNullException>(() => new MockEntity().Add<object>(null)); }
See Also