Struct IntBound
An IntBound defines a horizontal rectangle of tile positions. It is analogous to the UnityEngine.Bounds class for tile positions.
Namespace: TycoonTerrain.Core
Assembly: TycoonTerrainAssembly.dll
Syntax
public struct IntBound : IEquatable<IntBound>
Constructors
IntBound(int2, int2)
Creates a new instance of IntBound where min
is the minimum position in both directions and max
is the maximum position in both directions.
Declaration
public IntBound(int2 min, int2 max)
Parameters
Type | Name | Description |
---|---|---|
Unity.Mathematics.int2 | min | The minimum position in both directions (inclusive). |
Unity.Mathematics.int2 | max | The maximum position in both directions (inclusive). |
Properties
Invalid
Gets an invalid bounds.
Declaration
public static IntBound Invalid { get; }
Property Value
Type | Description |
---|---|
IntBound | An invalid bounds. |
IsValid
Returns true if this instance is valid.
Declaration
public bool IsValid { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
Max
The maximum position in both directions (inclusive).
Declaration
public int2 Max { get; }
Property Value
Type | Description |
---|---|
Unity.Mathematics.int2 | The maximum position in both directions (inclusive). |
Min
The minimum position in both directions (inclusive).
Declaration
public int2 Min { get; }
Property Value
Type | Description |
---|---|
Unity.Mathematics.int2 | The minimum position in both directions (inclusive). |
PositionsInBounds
Returns an enumeration of all the positions that lie within this bounds.
Declaration
public IEnumerable<int2> PositionsInBounds { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Unity.Mathematics.int2> | Each position within the bounds. |
Size
The size in both directions.
Declaration
public int2 Size { get; }
Property Value
Type | Description |
---|---|
Unity.Mathematics.int2 | The size in both directions. |
Methods
Contains(IntBound)
Returns whether the given bounds is contained within the bounds.
Declaration
public bool Contains(IntBound bounds)
Parameters
Type | Name | Description |
---|---|---|
IntBound | bounds | The bounds to be checked for. |
Returns
Type | Description |
---|---|
Boolean |
|
Contains(int2)
Returns whether the given position is contained within the bounds.
Declaration
public bool Contains(int2 pos)
Parameters
Type | Name | Description |
---|---|---|
Unity.Mathematics.int2 | pos | The position. |
Returns
Type | Description |
---|---|
Boolean |
|
Distance(int2)
Returns the closest distance between the given position and this bounds. Returns 0 if position lies within the bounds.
Declaration
public int Distance(int2 position)
Parameters
Type | Name | Description |
---|---|---|
Unity.Mathematics.int2 | position | The position to check against. |
Returns
Type | Description |
---|---|
Int32 | The closest distance between |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
Equals(IntBound)
Declaration
public bool Equals(IntBound other)
Parameters
Type | Name | Description |
---|---|---|
IntBound | other |
Returns
Type | Description |
---|---|
Boolean |
Expand(CardinalDirection, Int32)
Expands the bounds in the given direction by the given number of units.
Declaration
public IntBound Expand(CardinalDirection direction, int amount)
Parameters
Type | Name | Description |
---|---|---|
CardinalDirection | direction | The direction to expand the bounds to. |
Int32 | amount | The number of units to expand the bounds by. |
Returns
Type | Description |
---|---|
IntBound | The bounds expanded by |
Expand(int2)
Expands the bounds in all directions by the given number of units.
Declaration
public IntBound Expand(int2 expansion)
Parameters
Type | Name | Description |
---|---|---|
Unity.Mathematics.int2 | expansion | The number of units to expand in each direction. |
Returns
Type | Description |
---|---|
IntBound | The bounds expanded by |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
Intersection(IntBound)
Returns the intersection between the given bounds and this bounds.
Declaration
public IntBound Intersection(IntBound other)
Parameters
Type | Name | Description |
---|---|---|
IntBound | other | The other bounds. |
Returns
Type | Description |
---|---|
IntBound | The intersection between the given bounds and this bounds instance. |
Intersects(IntBound)
Returns whether the given bounds intersect with this bounds. True if they intersect, false otherwise.
Declaration
public bool Intersects(IntBound bounds)
Parameters
Type | Name | Description |
---|---|---|
IntBound | bounds | The bounds to check against. |
Returns
Type | Description |
---|---|
Boolean |
|
Operators
Equality(IntBound, IntBound)
Declaration
public static bool operator ==(IntBound left, IntBound right)
Parameters
Type | Name | Description |
---|---|---|
IntBound | left | |
IntBound | right |
Returns
Type | Description |
---|---|
Boolean |
Inequality(IntBound, IntBound)
Declaration
public static bool operator !=(IntBound left, IntBound right)
Parameters
Type | Name | Description |
---|---|---|
IntBound | left | |
IntBound | right |
Returns
Type | Description |
---|---|
Boolean |