public void DrawShouldNotGetCalledWhenContentNotLoaded() { collection.Draw(null, null); A.CallTo(() => drawableComponent.Draw(null, null)).MustNotHaveHappened(); A.CallTo(() => viewForPresenter.Draw(null, null)).MustNotHaveHappened(); }
public void DontDrawWhenComponentIsInvisible() { DrawableComponent disabledComponent = A.Fake <DrawableComponent>(); disabledComponent.Visible = false; // it is a fake, but it cannot fake visible because its sealed collection.Add(disabledComponent); collection.LoadContent(null); collection.Draw(null, null); A.CallTo(() => disabledComponent.Draw(null, null)).MustNotHaveHappened(); }
/// <summary> /// Draws /// </summary> /// <param name="gameTime"></param> public override void Draw(GameTime gameTime) { // Render platfrom platformDrawable.Draw(gameTime); // Render balls foreach (Ball ball in balls) { if (ball.Active == true) { ball.Drawable.Draw(gameTime); } } }
/// <summary> /// Called when entity should draw itself. /// </summary> public override void Draw() { // Do nothing if disabled if (!enabled) { return; } // Draw all component foreach (BaseComponent component in components) { if (component is DrawableComponent) { DrawableComponent drawableComponent = component as DrawableComponent; // Get bounding sphere of component transformed to entity space BoundingSphere sphere = drawableComponent.BoundingSphere.Transform(matrix); // Only draw if component is visible by camera if (drawableComponent.Infinite || sphere.Intersects(core.ActiveScene.Camera.BoundingFrustum)) { drawableComponent.Draw(this); } } else if (component is LightComponent) { LightComponent lightComponent = component as LightComponent; // Point lights must be visible to camera if ((component as LightComponent).Type == LightComponent.LightType.Point) { // Get bounding sphere of component transformed to entity space BoundingSphere sphere = lightComponent.PointBoundingSphere.Transform(matrix); // Only draw if component is visible by camera if (sphere.Intersects(core.ActiveScene.Camera.BoundingFrustum)) { core.Renderer.SubmitLight(lightComponent, this); } } else { core.Renderer.SubmitLight(lightComponent, this); } } } }
public void DrawInOrder() { DrawableComponent drawableComponentTwo = A.Fake <DrawableComponent>(); drawableComponent.DrawOrder = 1; drawableComponentTwo.DrawOrder = 2; A.CallTo(() => viewForPresenter.DrawOrder).Returns(3); collection.Add(drawableComponentTwo); using (var scope = Fake.CreateScope()) { collection.LoadContent(null); collection.Draw(null, null); using (scope.OrderedAssertions()) { A.CallTo(() => drawableComponent.Draw(null, null)).MustHaveHappened(); A.CallTo(() => drawableComponentTwo.Draw(null, null)).MustHaveHappened(); A.CallTo(() => viewForPresenter.Draw(null, null)).MustHaveHappened(); } } }
public void Draw(GameTime gameTime) { light.WorldTransform = block.Entity.Entry.LocalTransform.Matrix * block.BlockType.Owner.Body.WorldTransform; light.Draw(gameTime); }