Class ScyllaTriGrid<TCell>.Builder
Fluent builder for constructing ScyllaTriGrid<TCell> instances with complex or optional configuration.
Inherited Members
Namespace: Scylla.Core.Structures
Assembly: ScyllaCore.dll
Syntax
public sealed class ScyllaTriGrid<TCell>.Builder
Remarks
WithLayout(TriGridLayout) must be called before Build() or BuildConcrete(); omitting it throws InvalidOperationException.
Call Synchronized(object) to receive a ScyllaTriGrid<TCell>.SynchronizedScyllaTriGrid from Build(); BuildConcrete() throws when synchronized mode is active.
var grid = ScyllaTriGrid<int>.CreateBuilder()
.WithSize(8, 8)
.WithLayout(new TriGridLayout(1f))
.WithDefaultValue(-1)
.Build();
Methods
Build()
Builds and returns the configured grid or synchronized wrapper.
Declaration
public IScyllaGrid<TriCoord, TCell> Build()
Returns
| Type | Description |
|---|---|
| IScyllaGrid<TriCoord, TCell> | An IScyllaGrid<TCoord, TCell> instance. |
BuildConcrete()
Builds and returns the concrete unsynchronized grid.
Declaration
public ScyllaTriGrid<TCell> BuildConcrete()
Returns
| Type | Description |
|---|---|
| ScyllaTriGrid<TCell> | The configured ScyllaTriGrid instance. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown when Synchronized() was called. |
Synchronized(object)
Configures the builder to return a synchronized (thread-safe) wrapper.
Declaration
public ScyllaTriGrid<TCell>.Builder Synchronized(object syncRoot = null)
Parameters
| Type | Name | Description |
|---|---|---|
| object | syncRoot | Optional external lock object. |
Returns
| Type | Description |
|---|---|
| ScyllaTriGrid<TCell>.Builder | This builder instance for method chaining. |
WithDefaultValue(TCell)
Sets the default value to fill all cells with after construction.
Declaration
public ScyllaTriGrid<TCell>.Builder WithDefaultValue(TCell value)
Parameters
| Type | Name | Description |
|---|---|---|
| TCell | value | The default value. |
Returns
| Type | Description |
|---|---|
| ScyllaTriGrid<TCell>.Builder | This builder instance for method chaining. |
WithLayout(TriGridLayout)
Sets the spatial layout for world-space conversions.
Declaration
public ScyllaTriGrid<TCell>.Builder WithLayout(TriGridLayout layout)
Parameters
| Type | Name | Description |
|---|---|---|
| TriGridLayout | layout | The layout to use. |
Returns
| Type | Description |
|---|---|
| ScyllaTriGrid<TCell>.Builder | This builder instance for method chaining. |
WithSize(int, int)
Sets the grid dimensions.
Declaration
public ScyllaTriGrid<TCell>.Builder WithSize(int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | The number of rectangular columns. Must be at least 1. |
| int | height | The number of rectangular rows. Must be at least 1. |
Returns
| Type | Description |
|---|---|
| ScyllaTriGrid<TCell>.Builder | This builder instance for method chaining. |