private void FillcharacterBufferVisibility(NamelessGame game, Screen screen, ConsoleCamera camera, GameSettings settings, IWorldProvider world) { int camX = camera.getPosition().X; int camY = camera.getPosition().Y; Position playerPosition = game.PlayerEntity.GetComponentOfType <Position>(); BoundingBox b = new BoundingBox(camera.getPosition(), new Point(settings.GetWidthZoomed() + camX, settings.GetHeightZoomed() + camY)); for (int x = 0; x < settings.GetWidthZoomed(); x++) { for (int y = 0; y < settings.GetHeightZoomed(); y++) { screen.ScreenBuffer[x, y].isVisible = false; } } //return; if (fov == null) { { fov = new PermissiveVisibility((x, y) => { return(!world.GetTile(x, y).GetBlocksVision(game)); }, (x, y) => { Stopwatch s = Stopwatch.StartNew(); var lambdaLocalScreen = game.CameraEntity.GetComponentOfType <Screen>(); s.Stop(); s.ToString(); Point screenPoint = camera.PointToScreen(x, y); if (screenPoint.X >= 0 && screenPoint.X < settings.GetWidthZoomed() && screenPoint.Y >= 0 && screenPoint.Y < settings.GetHeightZoomed()) { lambdaLocalScreen.ScreenBuffer[screenPoint.X, screenPoint.Y].isVisible = true; } }, (x, y) => { if (Math.Abs(x) > 60 || Math.Abs(y) > 60) { return(10000); } // return (int)((x*x) + (y*y)); return(Math.Abs(x) + Math.Abs(y)); } ); } } fov.Compute(playerPosition.Point, 60); }
private void FillcharacterBufferVisibility(NamelessGame game, Screen screen, ConsoleCamera camera, GameSettings settings, IWorldProvider world) { int camX = camera.getPosition().X; int camY = camera.getPosition().Y; Position playerPosition = game.PlayerEntity.GetComponentOfType <Position>(); BoundingBox b = new BoundingBox(camera.getPosition(), new Point(settings.GetWidthZoomed() + camX, settings.GetHeightZoomed() + camY)); for (int x = 0; x < settings.GetWidthZoomed(); x++) { for (int y = 0; y < settings.GetHeightZoomed(); y++) { screen.ScreenBuffer[y, x].isVisible = true; } } return; if (fov == null) { fov = new PermissiveVisibility((x, y) => { return(!world.GetTile(x, y).GetBlocksVision(game)); }, (x, y) => { Point screenPoint = camera.PointToScreen(x, y); if (screenPoint.X >= 0 && screenPoint.X < settings.GetWidth() && screenPoint.Y >= 0 && screenPoint.Y < settings.GetHeight()) { screen.ScreenBuffer[screenPoint.X, screenPoint.Y].isVisible = true; } }, (x, y) => { return(Math.Abs(x) + Math.Abs(y)); } ); } fov.Compute(playerPosition.Point, 60); }