/// <summary> /// Render the actor. /// </summary> /// <param name="elapsedTime">The amount of elapsed time, in seconds.</param> /// <param name="lineBatch">The LineBatch to render to.</param> public override void Draw(float elapsedTime, LineBatch lineBatch) { if (lineBatch == null) { throw new ArgumentNullException("lineBatch"); } // draw a simple line lineBatch.DrawLine(position, position - velocity * lineLengthVelocityPercent, Color.Yellow); }
/// <summary> /// Draw the walls. /// </summary> /// <param name="lineBatch">The LineBatch to render to.</param> public void DrawWalls(LineBatch lineBatch) { if (lineBatch == null) { throw new ArgumentNullException("lineBatch"); } // draw each wall-line for (int wall = 0; wall < walls.Length / 2; wall++) { lineBatch.DrawLine(walls[wall * 2], walls[wall * 2 + 1], Color.Yellow); } }
/// <summary> /// Draw the walls. /// </summary> /// <param name="lineBatch">The LineBatch to render to.</param> public void DrawWalls(LineBatch lineBatch) { if (lineBatch == null) { throw new ArgumentNullException(nameof(lineBatch)); } // draw each wall-line if (Walls != null) { for (int wall = 0; wall < Walls.Length / 2; wall++) { lineBatch.DrawLine(Walls[wall * 2], Walls[wall * 2 + 1], Color); } } }
/// <summary> /// Render the particle system. /// </summary> /// <param name="lineBatch">The line batch which draws all the particles</param> public virtual void Draw(LineBatch lineBatch) { if (lifeRemaining > 0f) { if (lineBatch == null) { throw new ArgumentNullException("lineBatch"); } for (int i = 0; i < particles.Length; i++) { lineBatch.DrawLine(particles[i].Position, particles[i].Position - particles[i].Velocity * tailLength, particles[i].Color); } } }
/// <summary> /// Draw the walls. /// </summary> /// <param name="lineBatch">The LineBatch to render to.</param> public void DrawWalls(LineBatch lineBatch) { if (lineBatch == null) { throw new ArgumentNullException(nameof(lineBatch)); } // draw each wall-line if (Walls != null) { int viewportWidth = lineBatch.GraphicsDevice.Viewport.Width; int viewportHeight = lineBatch.GraphicsDevice.Viewport.Height; Vector2 startLine; Vector2 endLine; for (int wall = 0; wall < Walls.Length / 2; wall++) { startLine = new Vector2(Walls[wall * 2].X * viewportWidth, Walls[wall * 2].Y * viewportHeight); endLine = new Vector2(Walls[wall * 2 + 1].X * viewportWidth, Walls[wall * 2 + 1].Y * viewportHeight); lineBatch.DrawLine(startLine, endLine, Color); } } }