Class Table<T>
A weighted probability table for values of type {T}.
Inheritance
System.Object
Table<T>
Implements
IReadable<T>
Namespace: FasterGames.Whiskey.Tables
Assembly: cs.temp.dll.dll
Syntax
public abstract class Table<T> : ScriptableObject, IReadable<T>
Type Parameters
Name | Description |
---|---|
T | value type |
Fields
random
The rng source for the table querying operations
Declaration
public RngSource random
Field Value
Type | Description |
---|---|
RngSource |
tableEntries
The object entries
Declaration
protected List<Table<T>.TableEntry> tableEntries
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<Table.TableEntry<>> |
Properties
Entries
Read-only table entries
Declaration
public IReadOnlyList<Table<T>.TableEntry> Entries { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<Table.TableEntry<>> |
TotalWeightInTable
Editor preview of the weight in the table
Declaration
public float TotalWeightInTable { get; }
Property Value
Type | Description |
---|---|
System.Single |
Methods
Add(T, Single)
Add an entry to the table
Declaration
public void Add(T value, float weight)
Parameters
Type | Name | Description |
---|---|---|
T | value | direct value |
System.Single | weight | weight |
Add(Ref<T>, Single)
Add an entry to the table
Declaration
public void Add(Ref<T> value, float weight)
Parameters
Type | Name | Description |
---|---|---|
Ref<T> | value | value |
System.Single | weight | weight |
Clear()
Clear the table
Declaration
public void Clear()
Read()
Read the element.
Declaration
public T Read()
Returns
Type | Description |
---|---|
T | element data |