public VisionView(GraphicsEngine _graphicEngine, SpriteBatch sb, GraphicsDeviceManager _gman, Vector2 _cameraOffset, Point _origin, float rotation, List<Line> _visionBlockingLines) { graphicEngine = _graphicEngine; gman = _gman; origin = _origin; visionBlockingLines = _visionBlockingLines; cameraOffset = _cameraOffset; //List<Point> lightPolygon //lightPolygon = new Vision().GetLightPolygons(); vision = new Vision(origin, rotation, _visionBlockingLines); //Console.WriteLine(origin); displayLight(sb, cameraOffset, vision.lightTriangles); }
public static void Draw(Map map, GraphicsEngine graphicEngine) { List<Wall> walls = map.getWalls(); List<Obstacle> obstacles = map.getObstacles(); foreach (Wall w in walls) { //graphicEngine.AddCompletePolygon(w.polyline, Color.LightBlue); //graphicEngine.AddPolyline(w.polyline, Color.Blue); var wallColor = Color.DarkSlateGray; //var wallColor = Color.DarkGray; graphicEngine.AddPolyline(w.polyline, wallColor); graphicEngine.AddCompletePolygon(w.polyline, wallColor); // Color.DarkSlateGray } foreach (Obstacle o in obstacles) { /* graphicEngine.AddCompletePolygon(o.polyline, Color.PaleVioletRed); graphicEngine.AddPolyline(o.polyline, Color.Red);*/ graphicEngine.AddCompletePolygon(o.polyline, Color.SlateGray); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. SpriteBatch spriteBatch = new SpriteBatch(GraphicsDevice); graphicEngine = new GraphicsEngine(spriteBatch, graphics, GraphicsDevice, Content); /*XMLReader xmlTest = new XMLReader("../../../map.xml"); Map map = new Map(xmlTest.lowerRight, xmlTest.upperLeft, xmlTest.listObstacle, xmlTest.listWall); Player player = new Player("Champ"); environment = new GameEnvironment(map, player);*/ pengine = gengine.getPhysicsEngine(); // TODO: use this.Content to load your game content here inputManager = new InputManager(Mouse.GetState(), Keyboard.GetState(), environment.LocalPlayer); //Character testCharacter = new Character("Bonhomme", pengine, new Vector2(200, 100), new Vector2(100, 100)); //Character redshirt = new Character("Redshirt", pengine, new Vector2(400, 100), new Vector2(100, 100)); //environment.LocalPlayer.addCharacter(testCharacter); //environment.LocalPlayer.addCharacter(redshirt); graphicEngine.setFollowedCharacter(environment.LocalPlayer.getCharacter()); graphicEngine.setMap(environment.Map); }
//readonly Color visionViewColor = Color.White; //readonly Color visionViewColor = Color.SlateGray; public static Vision Draw(GraphicsEngine _graphicEngine, SpriteBatch sb, GraphicsDeviceManager _gman, Vector2 cameraOffset, Point origin, float rotation, List<Line> visionBlockingLines) { VisionView vv = new VisionView(_graphicEngine, sb, _gman, cameraOffset, origin, rotation, visionBlockingLines); //return vv.lightPolygon; return vv.vision; }