Show / Hide Table of Contents

Class RecursiveShadowcastingFOV

Implements IFOV by using a recursive shadow-casting implementation.

Inheritance
object
FOVBase
DoubleBasedFOVBase
RecursiveShadowcastingFOV
Implements
IFOV
IReadOnlyFOV
Inherited Members
DoubleBasedFOVBase.ResultView
DoubleBasedFOVBase.DoubleResultView
DoubleBasedFOVBase.BooleanResultView
FOVBase.AsReadOnly()
FOVBase.Calculate(int, int, double)
FOVBase.CalculateAppend(int, int, double)
FOVBase.Calculate(Point, double)
FOVBase.CalculateAppend(Point, double)
FOVBase.Calculate(int, int, double, Distance)
FOVBase.CalculateAppend(int, int, double, Distance)
FOVBase.Calculate(Point, double, Distance)
FOVBase.CalculateAppend(Point, double, Distance)
FOVBase.Calculate(int, int, double, Distance, double, double)
FOVBase.CalculateAppend(int, int, double, Distance, double, double)
FOVBase.Calculate(Point, double, Distance, double, double)
FOVBase.CalculateAppend(Point, double, Distance, double, double)
FOVBase.Reset()
FOVBase.ToString(char, char)
FOVBase.ToString(int)
FOVBase.ToString()
FOVBase.TransparencyView
FOVBase.CalculationsPerformed
FOVBase.Recalculated
FOVBase.VisibilityReset
object.GetType()
object.MemberwiseClone()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: GoRogue.FOV
Assembly: GoRogue.dll
Syntax
public class RecursiveShadowcastingFOV : DoubleBasedFOVBase, IFOV, IReadOnlyFOV
Remarks

Compared to the functionally equivalent implementation of recursive shadowcasting, RecursiveShadowcastingBooleanBasedFOV, this version is usually a reasonable default. However, this version can take up a great deal of memory for large maps; in these cases, you may prefer RecursiveShadowcastingBooleanBasedFOV instead.

Constructors

View Source

RecursiveShadowcastingFOV(IGridView<bool>, IEqualityComparer<Point>?)

Constructor.

Declaration
public RecursiveShadowcastingFOV(IGridView<bool> transparencyView, IEqualityComparer<Point>? hasher = null)
Parameters
Type Name Description
IGridView<bool> transparencyView

The values used to calculate field of view. Values of true are considered non-blocking (transparent) to line of sight, while false values are considered to be blocking.

IEqualityComparer<Point> hasher

The hashing algorithm to use for points in hash sets. Defaults to the default hash algorithm for Points.

Properties

View Source

CurrentFOV

IEnumerable of only positions currently in the field of view.

Declaration
public override IEnumerable<Point> CurrentFOV { get; }
Property Value
Type Description
IEnumerable<Point>
Overrides
FOVBase.CurrentFOV
View Source

NewlySeen

IEnumerable of positions that ARE in field of view as of the most current Calculate call, but were NOT in field of view after the previous time Calculate was called.

Declaration
public override IEnumerable<Point> NewlySeen { get; }
Property Value
Type Description
IEnumerable<Point>
Overrides
FOVBase.NewlySeen
View Source

NewlyUnseen

IEnumerable of positions that are NOT in field of view as of the most current Calculate call, but WERE in field of view after the previous time Calculate was called.

Declaration
public override IEnumerable<Point> NewlyUnseen { get; }
Property Value
Type Description
IEnumerable<Point>
Overrides
FOVBase.NewlyUnseen

Methods

View Source

OnCalculate(int, int, double, Distance)

Calculates FOV given an origin point, a radius, and radius shape.

Declaration
protected override void OnCalculate(int originX, int originY, double radius, Distance distanceCalc)
Parameters
Type Name Description
int originX

Coordinate x-value of the origin.

int originY

Coordinate y-value of the origin.

double radius

The maximum radius -- basically the maximum distance of the field of view if completely unobstructed.

Distance distanceCalc

The distance calculation used to determine what shape the radius has (or a type implicitly convertible to Distance, eg. Radius).

Overrides
FOVBase.OnCalculate(int, int, double, Distance)
Remarks

Custom implementations would implement this function to perform their calculation; the Calculate functions call this then fire relevant events.

View Source

OnCalculate(int, int, double, Distance, double, double)

Calculates FOV given an origin point, a radius, a radius shape, and the given field of view restrictions angle and span. The resulting field of view, if unobstructed, will be a cone defined by the angle and span given.

Declaration
protected override void OnCalculate(int originX, int originY, double radius, Distance distanceCalc, double angle, double span)
Parameters
Type Name Description
int originX

Coordinate x-value of the origin.

int originY

Coordinate y-value of the origin.

double radius

The maximum radius -- basically the maximum distance of the field of view if completely unobstructed.

Distance distanceCalc

The distance calculation used to determine what shape the radius has (or a type implicitly convertible to Distance, eg. Radius).

double angle

The angle in degrees that specifies the outermost center point of the field of view cone. 0 degrees points up, and angle increases result in the cone moving clockwise (like a compass).

double span

The angle, in degrees, that specifies the full arc contained in the field of view cone -- angle / 2 degrees are included on either side of the cone's center line.

Overrides
FOVBase.OnCalculate(int, int, double, Distance, double, double)
Remarks

Custom implementations would implement this function to perform their calculation; the Calculate functions call this then fire relevant events.

View Source

OnReset()

Resets all cells to not visible, and cycles current FOV to previous FOV, allowing a fresh set of calculations to begin.

Declaration
protected override void OnReset()
Overrides
FOVBase.OnReset()
Remarks

This is (indirectly) called automatically by all Calculate overloads. Custom implementations should implement this to reset their ResultView to all 0's in a way appropriate for their architecture, as well as cycle the current FOV to the previous FOV to prepare for a fresh FOV calculation. Reset() also calls this function, along with firing relevant events.

Implements

IFOV
IReadOnlyFOV

Extension Methods

Utility.Yield<T>(T)
  • View Source
In this article
Back to top Generated by DocFX