diff --git a/Shared/LinesOfSight.cs b/Shared/LinesOfSight.cs index 6ca2b33..de602b1 100644 --- a/Shared/LinesOfSight.cs +++ b/Shared/LinesOfSight.cs @@ -6,13 +6,15 @@ namespace SemiColinGames { class LinesOfSight : IDisposable { const int numEdgeVertices = 60; + + readonly VertexBuffer vertexBuffer; + readonly IndexBuffer indexBuffer; // coneVertices[0] is the eye position; the rest are the edge vertices. - VertexPositionColor[] coneVertices = new VertexPositionColor[numEdgeVertices + 1]; - Color color = Color.FromNonPremultiplied(new Vector4(0, 0, 1, 0.6f)); + readonly VertexPositionColor[] coneVertices = new VertexPositionColor[numEdgeVertices + 1]; // The number of total triangles drawn is one less than the number of edge points. - int[] indices = new int[(numEdgeVertices - 1) * 3]; - VertexBuffer vertexBuffer; - IndexBuffer indexBuffer; + readonly int[] indices = new int[(numEdgeVertices - 1) * 3]; + + Color color = Color.FromNonPremultiplied(new Vector4(0, 0, 1, 0.6f)); public LinesOfSight(GraphicsDevice graphics) { vertexBuffer = new VertexBuffer( @@ -72,8 +74,7 @@ namespace SemiColinGames { } } - public void Draw(Player player, AABB[] collisionTargets, GraphicsDevice graphics, - BasicEffect lightingEffect) { + public void Draw(GraphicsDevice graphics, BasicEffect lightingEffect) { for (int i = 0; i < numEdgeVertices - 1; i++) { indices[i * 3] = 0; diff --git a/Shared/Scene.cs b/Shared/Scene.cs index 33578dd..3b51a53 100644 --- a/Shared/Scene.cs +++ b/Shared/Scene.cs @@ -91,7 +91,7 @@ namespace SemiColinGames { graphics.Clear(new Color(0, 0, 0, 0f)); lightingEffect.Projection = camera.Projection; if (Debug.Enabled) { - linesOfSight.Draw(player, world.CollisionTargets, graphics, lightingEffect); + linesOfSight.Draw(graphics, lightingEffect); } // Draw debug rects & lines on top.