Namespace: DeltaEngine.Entities
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Tests: DeltaEngine.Tests.Entities.EntityTests
3 unit tests call DeltaEngine.Entities.Entity.ContainsTag(System.String)
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Parameters
- tag
- Type: System String
Return Value
Type: BooleanRemarks
Examples
[Test] public void SaveAndLoadEntityWithTwoComponentsFromMemoryStream() { entityWithTags.Add(1).Add(0.1f); var data = BinaryDataExtensions.SaveToMemoryStream(entityWithTags); var loadedEntity = data.CreateFromMemoryStream() as Entity; Assert.AreEqual(60, data.ToArray().Length); Assert.AreEqual(2, loadedEntity.NumberOfComponents); Assert.AreEqual(1, entityWithTags.Get<int>()); Assert.AreEqual(0.1f, entityWithTags.Get<float>()); Assert.IsTrue(loadedEntity.ContainsTag(Tag1)); Assert.IsTrue(loadedEntity.IsActive); Assert.AreEqual(0, loadedEntity.GetActiveBehaviors().Count); }
[Test] public void RemoveTag() { entityWithTags.RemoveTag(Tag1); Assert.IsFalse(entityWithTags.ContainsTag(Tag1)); Assert.IsTrue(entityWithTags.ContainsTag(Tag2)); Assert.AreEqual(0, entities.GetEntitiesWithTag(Tag1).Count); }
[Test] public void ClearTags() { entityWithTags.ClearTags(); Assert.IsFalse(entityWithTags.ContainsTag(Tag1)); Assert.IsFalse(entityWithTags.ContainsTag(Tag2)); Assert.AreEqual(0, entities.GetEntitiesWithTag(Tag1).Count); }
See Also