Class Behavior
BehaviorService - when logic gets a personality.
[Serializable]
public class Behavior : IBehaviorService, IServiceBase
- Inheritance
-
Behavior
- Implements
- Inherited Members
Constructors
Behavior()
protected Behavior()
Properties
Features
Gets a collection containing all defined features.
public IEnumerable<string> Features { get; }
Property Value
FilePath
Gets/Sets the import / export file path.
public string FilePath { get; set; }
Property Value
Instance
public static IBehaviorService Instance { get; }
Property Value
Methods
Export(string)
Writes all features to the specified file, or a previously defined FilePath if empty. Updates the FilePath setting.
public void Export(string filePath = "")
Parameters
filePathstringOptional. The (relative or absolute) file path.
GetFeature<T>(string)
Reads a feature's value. Type must match the original definition, an exception is thrown otherwise.
public T GetFeature<T>(string feature)
Parameters
featurestringThe feature name.
Returns
- T
The feature's value.
Type Parameters
TThe feature value's type.
Import(string)
Reads the specified file, or a previously defined FilePath if empty. Incrementally updates features with new values.
Call Services.Behavior.Reset() to clear all data first. Updates the FilePath setting.
public void Import(string filePath = "")
Parameters
filePathstringOptional. The (relative or absolute) file path.
Reset()
Initialize the service. This is called by the API when the service is first used.
public void Reset()
SetFeature<T>(string, T)
Defines a feature's value. Creates a new entry, or updates an existing one if it already exists.
public void SetFeature<T>(string feature, T value)
Parameters
featurestringThe feature name.
valueTThe feature's new value.
Type Parameters
TThe feature value's type.