public void SelectingEntitiesWithDifferentRenderLayer() { var entities = new MockEntitiesRunner(typeof(SortByRenderLayer)); var last = new MockDrawableEntity { RenderLayer = 13 }; last.OnDraw<SortByRenderLayer>(); var first = new MockDrawableEntity { RenderLayer = -1 }; first.OnDraw<SortByRenderLayer>(); var middle = new MockDrawableEntity { RenderLayer = 5 }; middle.OnDraw<SortByRenderLayer>(); SortedResult.Clear(); entities.RunEntities(); Assert.AreEqual(first, SortedResult[0]); Assert.AreEqual(middle, SortedResult[1]); Assert.AreEqual(last, SortedResult[2]); }
public void SelectingMultipleDifferentEntitiesWithDifferentRenderLayer() { var entities = new MockEntitiesRunner(typeof(SortByRenderLayer), typeof(AnotherSortByRenderLayer)); var last = new MockDrawableEntity(); last.OnDraw<SortByRenderLayer>(); last.RenderLayer = 13; var first = new MockDrawableEntity { RenderLayer = -1 }; first.OnDraw<AnotherSortByRenderLayer>(); var middle1 = new MockDrawableEntity { RenderLayer = 5 }; middle1.OnDraw<SortByRenderLayer>(); var middle2 = new MockDrawableEntity { RenderLayer = 5 }; middle2.OnDraw<AnotherSortByRenderLayer>(); SortedResult.Clear(); entities.RunEntities(); Assert.AreEqual(first, SortedResult[0]); Assert.AreEqual(middle1, SortedResult[1]); Assert.AreEqual(middle2, SortedResult[2]); Assert.AreEqual(last, SortedResult[3]); }
public void RemoveUpdateAndDrawBehaviorWhenRemovingAnEntityWithDifferentRenderLayers() { var entity = new MockDrawableEntity(); entity.Start<IncrementCounter>(); entity.Set(2); entity.OnDraw<DrawTest>(); entity.IsActive = false; var entity2 = new MockDrawableEntity(); entity2.Start<IncrementCounter>(); entity2.Set(-5); entity2.OnDraw<DrawTest>(); entity2.IsActive = false; entities.RunEntities(); }
public void GetDrawBehaviorFromNegativeRenderLayerEntity() { var entities = new MockEntitiesRunner(typeof(SortByRenderLayer), typeof(AnotherSortByRenderLayer)); var first = new MockDrawableEntity { RenderLayer = -1 }; first.OnDraw<SortByRenderLayer>(); var middle1 = new MockDrawableEntity { RenderLayer = -1 }; middle1.OnDraw<SortByRenderLayer>(); entities.RunEntities(); }
public void RemoveUpdateAndDrawBehaviorWhenRemovingAnEntity() { var entity = new MockDrawableEntity(); entity.Start<IncrementCounter>(); entity.OnDraw<DrawTest>(); entity.IsActive = false; entities.RunEntities(); }