C#
Latest commit 90030e8 Feb 16, 2017 @THEjoezack committed on GitHub Update README.md
Permalink
Failed to load latest commit information.
ShadowCaster
.gitattributes
.gitignore
LICENSE.txt
README.md
ShadowCaster.sln

README.md

ShadowCaster

This is a copy of the ShadowCasting code from the MSDN Developer Blog of Eric Lippert.

Read more about it in his series of posts on blogs.msdn.microsoft.com:

Availabe via nuget:

Install-Package ShadowCaster

Usage Example:

var cellsInFieldOfView = new List<Cell>(); // will hold our Cell which ARE visible in the field of view

ShadowCaster.ComputeFieldOfViewWithShadowCasting(
  5, // x position of the object doing the viewing
  6, // x position of the object doing the viewing
  4, // The sight radius, represents how far the position can see
  (x,y) => { return myMap.getCell(x,y).IsWall(); }, // Func that returns whether the cell can be seen through
  (x,y) => { cellsInFieldOfView.Add(myMap.getCell(x,y)); } // Action that specifies what to do with each item that IS in the field of view
);

// Note: myMap and Cell objects are just examples of the types of classes you might use