Struct LandTile
LandTile struct is responsible for containing the actual height data for each tile corner, as well as a water level. It provides some utility properties and functions on top of this.
Namespace: TycoonTerrain.Core
Assembly: TycoonTerrainAssembly.dll
Syntax
[Serializable]
public struct LandTile : IEquatable<LandTile>
Remarks
It is recommended to use the TileHandle type instead when interacting with tiles.
Properties
Heights
Gets the heights of all corners in the form of a vector, in the order (x = NorthEast, y = SouthEast, z = SouthWest, w = NorthWest).
Declaration
public int4 Heights { get; }
Property Value
Type | Description |
---|---|
Unity.Mathematics.int4 | The corner heights where x = NorthEast, y = SouthEast, z = SouthWest, w = NorthWest. |
IsAASlope
Whether this tile is an axis aligned slope.
Declaration
public bool IsAASlope { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
IsFlat
Whether this tile is completely flat (eg. all corner heights are equal).
Declaration
public bool IsFlat { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
WaterLevel
Gets the water level in this tile.
Declaration
public ushort WaterLevel { get; }
Property Value
Type | Description |
---|---|
UInt16 | The water level. |
Methods
DecreaseHeight(Int32)
Decreases the height of the highest corners of the tile by one.
Declaration
public void DecreaseHeight(int minHeight)
Parameters
Type | Name | Description |
---|---|---|
Int32 | minHeight |
DecreaseHeight(Int32, CornerIndex)
Declaration
public int DecreaseHeight(int minHeight, CornerIndex cornerIndex)
Parameters
Type | Name | Description |
---|---|---|
Int32 | minHeight | |
CornerIndex | cornerIndex |
Returns
Type | Description |
---|---|
Int32 |
Equals(Object)
Determines whether the specified Object, is equal to this instance.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The Object to compare with this instance. |
Returns
Type | Description |
---|---|
Boolean |
|
Overrides
Equals(LandTile)
Equalses the specified other.
Declaration
public bool Equals(LandTile other)
Parameters
Type | Name | Description |
---|---|---|
LandTile | other | The other. |
Returns
Type | Description |
---|---|
Boolean |
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
GetHeight(CornerIndex)
Gets the tile corner height for a given corner.
Declaration
public byte GetHeight(CornerIndex corner)
Parameters
Type | Name | Description |
---|---|---|
CornerIndex | corner | The tile corner. |
Returns
Type | Description |
---|---|
Byte |
Exceptions
Type | Condition |
---|---|
ArgumentException | Invalid corner direction |
GetHighestPoint()
Gets the height of the highest corner.
Declaration
public byte GetHighestPoint()
Returns
Type | Description |
---|---|
Byte | The height of the highest corner. |
GetLowestPoint()
Gets the height of the lowest corner.
Declaration
public byte GetLowestPoint()
Returns
Type | Description |
---|---|
Byte | The height of the lowest corner. |
IncreaseHeight(Byte, CornerIndex)
Increases the height of the corner of the specified corner index by one. Handles neighboring corner height increases as well.
Declaration
public void IncreaseHeight(byte maxHeight, CornerIndex cornerIndex)
Parameters
Type | Name | Description |
---|---|---|
Byte | maxHeight | |
CornerIndex | cornerIndex | The index of the corner. |
IncreaseHeight(Int32)
Increases the height of the lowest corners of the tile by one.
Declaration
public int IncreaseHeight(int maxHeight)
Parameters
Type | Name | Description |
---|---|---|
Int32 | maxHeight |
Returns
Type | Description |
---|---|
Int32 | The total number of height adjustments by all corners. |
MaxHeight(int4)
Sets the height of all corners of this tile to the maximum of 'max' the existing height.
Declaration
public void MaxHeight(int4 max)
Parameters
Type | Name | Description |
---|---|---|
Unity.Mathematics.int4 | max | The height at which all corners should maximally be set. |