public void Draw()
{
if (!(amDrawing || amErasing))
{
primitiveBatch.Begin(PrimitiveType.LineList);
if (canIDraw && canIErase)
{
primitiveBatch.AddVertex(startpoint, IN_SIGHT);
primitiveBatch.AddVertex(endpoint, IN_SIGHT);
primitiveBatch.AddVertex(new Vector2(startpoint.X, startpoint.Y + 2), IN_SIGHT);
primitiveBatch.AddVertex(new Vector2(endpoint.X, endpoint.Y + 2), IN_SIGHT);
primitiveBatch.AddVertex(new Vector2(startpoint.X, startpoint.Y + 1), IN_SIGHT);
primitiveBatch.AddVertex(new Vector2(endpoint.X, endpoint.Y + 1), IN_SIGHT);
primitiveBatch.AddVertex(new Vector2(startpoint.X, startpoint.Y - 1), IN_SIGHT);
primitiveBatch.AddVertex(new Vector2(endpoint.X, endpoint.Y - 1), IN_SIGHT);
primitiveBatch.AddVertex(new Vector2(startpoint.X, startpoint.Y - 2), IN_SIGHT);
primitiveBatch.AddVertex(new Vector2(endpoint.X, endpoint.Y - 2), IN_SIGHT);
}
else
{
primitiveBatch.AddVertex(startpoint, OUT_SIGHT);
primitiveBatch.AddVertex(endpoint, OUT_SIGHT);
primitiveBatch.AddVertex(new Vector2(startpoint.X, startpoint.Y + 2), OUT_SIGHT);
primitiveBatch.AddVertex(new Vector2(endpoint.X, endpoint.Y + 2), OUT_SIGHT);
primitiveBatch.AddVertex(new Vector2(startpoint.X, startpoint.Y + 1), OUT_SIGHT);
primitiveBatch.AddVertex(new Vector2(endpoint.X, endpoint.Y + 1), OUT_SIGHT);
primitiveBatch.AddVertex(new Vector2(startpoint.X, startpoint.Y - 1), OUT_SIGHT);
primitiveBatch.AddVertex(new Vector2(endpoint.X, endpoint.Y - 1), OUT_SIGHT);
primitiveBatch.AddVertex(new Vector2(startpoint.X, startpoint.Y - 2), OUT_SIGHT);
primitiveBatch.AddVertex(new Vector2(endpoint.X, endpoint.Y - 2), OUT_SIGHT);
}
primitiveBatch.End();
}
else
{
GameEngine.Instance.SpriteBatch.Begin();
Common.Utils.stretchForLaser(GameEngine.Instance.SpriteBatch, sectionTex, startpoint, endpoint, Color.White, sourceRect);
GameEngine.Instance.SpriteBatch.End();
}
}