Entity ClassDelta Engine Documentation
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

System Object
  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

public abstract class Entity : IDisposable

The Entity type exposes the following members.

Constructors

  NameDescription
Protected methodEntity
Top
Methods

  NameDescription
Public methodAdd T 
Public methodAddTag
Public methodClearTags
Public methodContains T 
Public methodContainsBehavior T 
Public methodContainsTag
Protected methodDeactivate
Public methodDispose
Public methodGet T 
Gets a specific component, derived classes can return faster cached values (e.g. Entity2D) View code on GitHub
Protected methodGetActiveBehaviors
Protected methodGetComponentsForSaving
Public methodGetOrDefault T 
Public methodGetTags
Public methodRemove T 
Public methodRemoveTag
Public methodSet
Public methodSetComponents
Public methodStart T 
Public methodStop T 
Public methodToString (Overrides Object ToString .)
Top
Fields

  NameDescription
Protected fieldcomponents
Top
Properties

  NameDescription
Public propertyIsActive
Public propertyIsPauseable
Public propertyNumberOfComponents
Public propertyUpdatePriority
Top
Remarks

Tests: DeltaEngine.Tests.Entities.EntityTests
Examples

30 unit tests call DeltaEngine.Entities.Entity
[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