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
Feature(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 |
---|---|---|
System.String | id | The JSON key. |
System.Func<JsonAny, T> | factory | A delegate that parses JsonAny into |
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).
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentException | A Feature with the given |
Methods
TryGet(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 |
---|---|
System.Boolean |
|
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).