Interface ISenseSource
Interfaces representing sources which can be used by sense maps.
Namespace: GoRogue.SenseMapping.Sources
Assembly: GoRogue.dll
Syntax
public interface ISenseSource
Properties
View SourceAngle
If IsAngleRestricted is true, the angle in degrees that represents a line from the source's start to the outermost center point of the cone formed by the source's calculated values. 0 degrees points up, and increases in angle move clockwise (like a compass). Otherwise, this will be 0.0 degrees.
Declaration
double Angle { get; set; }
Property Value
Type | Description |
---|---|
double |
Decay
The amount of decrease in sense source value per unit of distance. Calculated automatically as a product of Intensity and Radius.
Declaration
double Decay { get; }
Property Value
Type | Description |
---|---|
double |
DistanceCalc
The distance calculation used to determine what shape the radius has (or a type implicitly convertible to Distance, such as Radius).
Declaration
Distance DistanceCalc { get; set; }
Property Value
Type | Description |
---|---|
Distance |
Enabled
Whether or not this source is enabled. If a source is disabled when Calculate() is called, the source does not calculate values and is effectively assumed to be "off".
Declaration
bool Enabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
Intensity
The starting value of the source to spread. Defaults to 1.0.
Declaration
double Intensity { get; set; }
Property Value
Type | Description |
---|---|
double |
IsAngleRestricted
Whether or not the spreading of values from this source is restricted to an angle and span.
Declaration
bool IsAngleRestricted { get; set; }
Property Value
Type | Description |
---|---|
bool |
Position
The position on a map that the source is located at.
Declaration
ref Point Position { get; }
Property Value
Type | Description |
---|---|
Point |
Radius
The maximum radius of the source -- this is the maximum distance the source values will emanate, provided the area is completely unobstructed. Changing this will trigger resizing (re-allocation) of the underlying arrays.
Declaration
double Radius { get; set; }
Property Value
Type | Description |
---|---|
double |
ResistanceView
The resistance map used to perform calculations.
Declaration
IGridView<double>? ResistanceView { get; }
Property Value
Type | Description |
---|---|
IGridView<double> |
Remarks
Sense map implementations will set this to the sense map's resistance map prior to calculating. This can be set via SetResistanceMap(IGridView<double>?), but you shouldn't do this unless you're creating a custom sense map implementation.
ResultView
A grid view representing the result of a sense map calculation.
Declaration
IGridView<double> ResultView { get; }
Property Value
Type | Description |
---|---|
IGridView<double> |
Span
If IsAngleRestricted is true, the angle in degrees that represents the full arc of the cone formed by the source's calculated values. Otherwise, it will be 360 degrees.
Declaration
double Span { get; set; }
Property Value
Type | Description |
---|---|
double |
Methods
View SourceCalculateLight()
Perform the lighting calculations if the source is enabled, by first clearing results of the existing calculation, then re-calculating it by calling OnCalculate().
Declaration
void CalculateLight()
OnCalculate()
Performs the actual spreading calculation.
Declaration
void OnCalculate()
SetResistanceMap(IGridView<double>?)
Should ONLY be called from SenseMap or equivalent implementations. Sets the resistance map used by the source for calculations.
Declaration
void SetResistanceMap(IGridView<double>? resMap)
Parameters
Type | Name | Description |
---|---|---|
IGridView<double> | resMap |
Events
View SourceRadiusChanged
Fired when the radius of the source changes.
Declaration
event EventHandler? RadiusChanged
Event Type
Type | Description |
---|---|
EventHandler |