Show / Hide Table of Contents

Interface IFOV

Interface representing the capability to calculate a grid-based field of view for a map.

Inherited Members
IReadOnlyFOV.AsReadOnly()
IReadOnlyFOV.ToString(char, char)
IReadOnlyFOV.ToString(int)
IReadOnlyFOV.TransparencyView
IReadOnlyFOV.BooleanResultView
IReadOnlyFOV.DoubleResultView
IReadOnlyFOV.CurrentFOV
IReadOnlyFOV.NewlySeen
IReadOnlyFOV.NewlyUnseen
IReadOnlyFOV.CalculationsPerformed
Namespace: GoRogue.FOV
Assembly: GoRogue.dll
Syntax
public interface IFOV : IReadOnlyFOV
Remarks

If you want a concrete implementation of FOV, see the RecursiveShadowcastingFOV class. If you're implementing your own FOV system, you may want to consider inheriting from FOVBase if possible, as it implements much of the boilerplate code involved in implementing this interface.

This interface conceptualizes FOV as a calculation based on a "transparency" map, represented by the TransparencyView property. This view acts as input to the calculation; a value of "true" indicates that a given position is transparent (i.e. does NOT block LOS), whereas a value of "false" indicates that a position DOES block line of sight.

The calculation will be performed by the Calculate functions. It should perform calculations such that the following fields produce the correct output (which is noted in the property documentation): - BooleanResultView - DoubleResultView - CurrentFOV - NewlySeen - NewlyUnseen

The Calculate functions should also fire the Recalculated event.

Some of the output values can be derived based on others; for example, by definition, BooleanResultView should simply return true for any square where DoubleResultView returns a value > 0.0. For this reason, as stated above, it is recommended that custom implementations inherit from FOVBase where possible, as it sets this all up correctly, and instead requires that you implement the minimal subset of properties/functions.

Methods

View Source

Calculate(Point, double)

Calculates FOV given an origin point and a radius, overwriting the current FOV entirely. If no radius is specified, simply calculates with a radius of maximum integer value, which is effectively infinite. Radius is computed as a circle around the source (type Circle).

Declaration
void Calculate(Point origin, double radius = 1.7976931348623157E+308)
Parameters
Type Name Description
Point origin

Position of origin.

double radius

The maximum radius -- basically the maximum distance of the field of view if completely unobstructed. If no radius is specified, it is effectively infinite.

View Source

Calculate(Point, double, Distance)

Calculates FOV given an origin point, a radius, and a radius shape, overwriting the current FOV entirely.

Declaration
void Calculate(Point origin, double radius, Distance distanceCalc)
Parameters
Type Name Description
Point origin

Coordinate 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).

View Source

Calculate(Point, 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 current field of view will be entirely overwritten with the new one. The resulting field of view, if unobstructed, will be a cone defined by the angle and span given.

Declaration
void Calculate(Point origin, double radius, Distance distanceCalc, double angle, double span)
Parameters
Type Name Description
Point origin

Coordinate 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 span line.

View Source

Calculate(int, int, double)

Calculates FOV given an origin point and a radius, overwriting the current FOV entirely. If no radius is specified, simply calculates with a radius of maximum integer value, which is effectively infinite. Radius is computed as a circle around the source (type Circle).

Declaration
void Calculate(int originX, int originY, double radius = 1.7976931348623157E+308)
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. If no radius is specified, it is effectively infinite.

View Source

Calculate(int, int, double, Distance)

Calculates FOV given an origin point, a radius, and radius shape, overwriting the current FOV entirely.

Declaration
void Calculate(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).

View Source

Calculate(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 current field of view will be entirely overwritten with the new one. The resulting field of view, if unobstructed, will be a cone defined by the angle and span given.

Declaration
void Calculate(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.

View Source

CalculateAppend(Point, double)

Calculates FOV given an origin point and a radius, adding the result onto the currently visible cells. If no radius is specified, simply calculates with a radius of maximum integer value, which is effectively infinite. Radius is computed as a circle around the source (type Circle).

Declaration
void CalculateAppend(Point origin, double radius = 1.7976931348623157E+308)
Parameters
Type Name Description
Point origin

Position of origin.

double radius

The maximum radius -- basically the maximum distance of the field of view if completely unobstructed. If no radius is specified, it is effectively infinite.

View Source

CalculateAppend(Point, double, Distance)

Calculates FOV given an origin point, a radius, and a radius shape, , adding the result onto the currently visible cells.

Declaration
void CalculateAppend(Point origin, double radius, Distance distanceCalc)
Parameters
Type Name Description
Point origin

Coordinate 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).

View Source

CalculateAppend(Point, 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 new field of view will be added onto the current one. The resulting field of view, if unobstructed, will be a cone defined by the angle and span given.

Declaration
void CalculateAppend(Point origin, double radius, Distance distanceCalc, double angle, double span)
Parameters
Type Name Description
Point origin

Coordinate 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 span line.

View Source

CalculateAppend(int, int, double)

Calculates FOV given an origin point and a radius, adding the result onto the currently visible cells. If no radius is specified, simply calculates with a radius of maximum integer value, which is effectively infinite. Radius is computed as a circle around the source (type Circle).

Declaration
void CalculateAppend(int originX, int originY, double radius = 1.7976931348623157E+308)
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. If no radius is specified, it is effectively infinite.

View Source

CalculateAppend(int, int, double, Distance)

Calculates FOV given an origin point, a radius, and radius shape, adding the result onto the currently visible cells.

Declaration
void CalculateAppend(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).

View Source

CalculateAppend(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 new field of view will be added onto the current one. The resulting field of view, if unobstructed, will be a cone defined by the angle and span given.

Declaration
void CalculateAppend(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.

View Source

Reset()

Resets the given field of view to no tiles visible.

Declaration
void Reset()
Remarks

After this function is called, any value in DoubleResultView will be 0, and any value in BooleanResultView will be false. Additionally, CurrentFOV will be blank.

Events

View Source

Recalculated

Fired whenever the FOV is recalculated.

Declaration
event EventHandler<FOVRecalculatedEventArgs>? Recalculated
Event Type
Type Description
EventHandler<FOVRecalculatedEventArgs>
View Source

VisibilityReset

Fired when the existing FOV is reset prior to calculating a new one.

Declaration
event EventHandler? VisibilityReset
Event Type
Type Description
EventHandler

Extension Methods

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