Class BoundsReservationRegister
This class is used to exclusively register given bounds to only a single user. Example use cases are buildings
Namespace: TycoonTerrain.Core
Assembly: TycoonTerrainAssembly.dll
Syntax
public class BoundsReservationRegister
Constructors
BoundsReservationRegister(BoundsContainer)
Declaration
public BoundsReservationRegister(BoundsContainer bounds)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundsContainer | bounds |
Methods
CanRegister(IntBound)
Whether all positions within the given bounds are still available. False otherwise.
Declaration
public bool CanRegister(IntBound bounds)
Parameters
| Type | Name | Description |
|---|---|---|
| IntBound | bounds | The bounds to check for. |
Returns
| Type | Description |
|---|---|
| Boolean |
IsOccupied(IntBound)
Returns whether any positions within the given bounds are occupied. False otherwise.
Declaration
public bool IsOccupied(IntBound bounds)
Parameters
| Type | Name | Description |
|---|---|---|
| IntBound | bounds | The bounds to check for. |
Returns
| Type | Description |
|---|---|
| Boolean |
Register(IntBound)
Registers the given bounds and returns the assigned identifier. Will throw an exception if bounds could not be registered.
Declaration
public int Register(IntBound bounds)
Parameters
| Type | Name | Description |
|---|---|---|
| IntBound | bounds | The bounds to register |
Returns
| Type | Description |
|---|---|
| Int32 |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException |
TryRegister(IntBound, out Int32)
Tries to register the given bounds. Returns true if succeeded, false otherwise.
Declaration
public bool TryRegister(IntBound bounds, out int id)
Parameters
| Type | Name | Description |
|---|---|---|
| IntBound | bounds | The bounds to register. |
| Int32 | id | The generated identifier for this bounds if it was registered succesfully. Will be set to an undefined value if registering failed and the value should not be used in that case. |
Returns
| Type | Description |
|---|---|
| Boolean |