Class Feature<T>
A strongly-typed constant setting of a SlugBaseCharacter.
Inherited Members
Namespace: SlugBase.Features
Assembly: SlugBase.dll
Syntax
public class Feature<T> : Feature
Type Parameters
| Name | Description |
|---|---|
| T | The type that stores this setting's information. |
Remarks
PlayerFeature<T> and GameFeature<T> should be used when possible.
Otherwise, consider making a child class with a TryGet method that finds the most
appropriate SlugBaseCharacter to pass to TryGet(SlugBaseCharacter, out T).
Constructors
View SourceFeature(string, Func<JsonAny, T>)
Creates a new Feature<T> with the given id.
Declaration
public Feature(string id, Func<JsonAny, T> factory)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The JSON key. |
| Func<JsonAny, T> | factory | A delegate that parses JsonAny into |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentNullException |
|
| ArgumentException | A Feature with the given |
Methods
View SourceTryGet(SlugBaseCharacter, out T)
Gets the T instance assocated with character.
Declaration
public bool TryGet(SlugBaseCharacter character, out T value)
Parameters
| Type | Name | Description |
|---|---|---|
| SlugBaseCharacter | character | The SlugBaseCharacter that may have this Feature. |
| T | value | The stored setting, or |
Returns
| Type | Description |
|---|---|
| bool |
|