Class Radius
Class representing different shapes that define the concept of a radius on a grid. You cannot create instances of this class using a constructor -- instead, this class contains static instances representing the various radius shapes.
Inheritance
Implements
Inherited Members
Namespace: GoRogue
Assembly: GoRogue.dll
Syntax
[Serializable]
public class Radius : IEquatable<Radius>
Remarks
Contains utility functions to work with radius shapes. Instances of Radius are also implicitly convertible to both Distance and AdjacencyRule (since both a method of determining adjacent locations and a method of calculating distance are implied by a radius shape).
Fields
| Improve this Doc View SourceCIRCLE
Radius is a circle around the center point. CIRCLE would represent movement radius in an 8-way movement scheme with a ~1.41 cost multiplier for diagonal movement.
Declaration
[NonSerialized]
public static readonly Radius CIRCLE
Field Value
Type | Description |
---|---|
Radius |
CUBE
Radius is a cube around the center point. Similar to SQUARE in 2d shape.
Declaration
[NonSerialized]
public static readonly Radius CUBE
Field Value
Type | Description |
---|---|
Radius |
DIAMOND
Radius is a diamond around the center point. DIAMOND would represent movement radius in a 4-way movement scheme.
Declaration
[NonSerialized]
public static readonly Radius DIAMOND
Field Value
Type | Description |
---|---|
Radius |
OCTAHEDRON
Radius is an octahedron around the center point. Similar to DIAMOND in 2d shape.
Declaration
[NonSerialized]
public static readonly Radius OCTAHEDRON
Field Value
Type | Description |
---|---|
Radius |
SPHERE
Radius is a sphere around the center point. Similar to CIRCLE in 2d shape.
Declaration
[NonSerialized]
public static readonly Radius SPHERE
Field Value
Type | Description |
---|---|
Radius |
SQUARE
Radius is a square around the center point. SQUARE would represent movement radius in an 8-way movement scheme, where all 8 squares around an item are considered equal distance away.
Declaration
[NonSerialized]
public static readonly Radius SQUARE
Field Value
Type | Description |
---|---|
Radius |
Type
Enum value representing the radius shape -- useful for using Radius types in switch statements.
Declaration
public readonly Radius.Types Type
Field Value
Type | Description |
---|---|
Radius.Types |
Methods
| Improve this Doc View SourceEquals(Radius)
Compares the current Radius to the one given.
Declaration
public bool Equals(Radius other)
Parameters
Type | Name | Description |
---|---|---|
Radius | other |
Returns
Type | Description |
---|---|
System.Boolean | True if the given Radius has the same Type, false otherwise. |
Equals(Object)
Compares the current Radius to the object given.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean | True if the given object is a Radius with the same Type, false otherwise. |
Overrides
GetHashCode()
Returns a hash-value for this object.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
ToRadius(Radius.Types)
Gets the Radius class instance representing the radius type specified.
Declaration
public static Radius ToRadius(Radius.Types radiusType)
Parameters
Type | Name | Description |
---|---|---|
Radius.Types | radiusType | The enum value for the radius shape. |
Returns
Type | Description |
---|---|
Radius | The radius class representing the given radius shape. |
ToString()
Returns a string representation of the Radius.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string representation of the Radius. |
Overrides
Operators
| Improve this Doc View SourceEquality(Radius, Radius)
Compares the two Radius instances.
Declaration
public static bool operator ==(Radius lhs, Radius rhs)
Parameters
Type | Name | Description |
---|---|---|
Radius | lhs | |
Radius | rhs |
Returns
Type | Description |
---|---|
System.Boolean | True if the two given Radius instances have the same Type, false otherwise. |
Implicit(Radius to AdjacencyRule)
Allows implicit casting to the AdjacencyRule type.
Declaration
public static implicit operator AdjacencyRule(Radius radius)
Parameters
Type | Name | Description |
---|---|---|
Radius | radius | Radius type being casted. |
Returns
Type | Description |
---|---|
AdjacencyRule |
Remarks
The rule corresponding to the proper definition of distance that creates the radius shape casted will be returned.
Implicit(Radius to Distance)
Allows implicit casting to the Distance type.
Declaration
public static implicit operator Distance(Radius radius)
Parameters
Type | Name | Description |
---|---|---|
Radius | radius | Radius type being casted. |
Returns
Type | Description |
---|---|
Distance |
Remarks
The Distance instance corresponding to the proper definition of distance that creates the radius shape casted will be returned.
Inequality(Radius, Radius)
Compares the two Radius instances.
Declaration
public static bool operator !=(Radius lhs, Radius rhs)
Parameters
Type | Name | Description |
---|---|---|
Radius | lhs | |
Radius | rhs |
Returns
Type | Description |
---|---|
System.Boolean | True if the two given Radius instances do NOT have the same Type, false otherwise. |