small cleanups suggested by VS

GitOrigin-RevId: b1b3a687e399f0672a436c6542914143adaea6bb
This commit is contained in:
Colin McMillen 2020-02-19 16:36:38 -05:00
parent 026623ac82
commit af9a48bc5d
2 changed files with 9 additions and 8 deletions

View File

@ -6,13 +6,15 @@ namespace SemiColinGames {
class LinesOfSight : IDisposable { class LinesOfSight : IDisposable {
const int numEdgeVertices = 60; const int numEdgeVertices = 60;
readonly VertexBuffer vertexBuffer;
readonly IndexBuffer indexBuffer;
// coneVertices[0] is the eye position; the rest are the edge vertices. // coneVertices[0] is the eye position; the rest are the edge vertices.
VertexPositionColor[] coneVertices = new VertexPositionColor[numEdgeVertices + 1]; readonly VertexPositionColor[] coneVertices = new VertexPositionColor[numEdgeVertices + 1];
Color color = Color.FromNonPremultiplied(new Vector4(0, 0, 1, 0.6f));
// The number of total triangles drawn is one less than the number of edge points. // The number of total triangles drawn is one less than the number of edge points.
int[] indices = new int[(numEdgeVertices - 1) * 3]; readonly int[] indices = new int[(numEdgeVertices - 1) * 3];
VertexBuffer vertexBuffer;
IndexBuffer indexBuffer; Color color = Color.FromNonPremultiplied(new Vector4(0, 0, 1, 0.6f));
public LinesOfSight(GraphicsDevice graphics) { public LinesOfSight(GraphicsDevice graphics) {
vertexBuffer = new VertexBuffer( vertexBuffer = new VertexBuffer(
@ -72,8 +74,7 @@ namespace SemiColinGames {
} }
} }
public void Draw(Player player, AABB[] collisionTargets, GraphicsDevice graphics, public void Draw(GraphicsDevice graphics, BasicEffect lightingEffect) {
BasicEffect lightingEffect) {
for (int i = 0; i < numEdgeVertices - 1; i++) { for (int i = 0; i < numEdgeVertices - 1; i++) {
indices[i * 3] = 0; indices[i * 3] = 0;

View File

@ -91,7 +91,7 @@ namespace SemiColinGames {
graphics.Clear(new Color(0, 0, 0, 0f)); graphics.Clear(new Color(0, 0, 0, 0f));
lightingEffect.Projection = camera.Projection; lightingEffect.Projection = camera.Projection;
if (Debug.Enabled) { if (Debug.Enabled) {
linesOfSight.Draw(player, world.CollisionTargets, graphics, lightingEffect); linesOfSight.Draw(graphics, lightingEffect);
} }
// Draw debug rects & lines on top. // Draw debug rects & lines on top.