BGC Tools
Public Member Functions | Private Attributes
BGC.StateMachine.StateData< TBoolEnum, TTriggerEnum > Class Template Reference

Contains data for a state machine with descriptive functions to improve code clarity. More...

Collaboration diagram for BGC.StateMachine.StateData< TBoolEnum, TTriggerEnum >:
Collaboration graph
[legend]

Public Member Functions

void Initialize ()
 initialize data with original booleans More...
 
void Clear ()
 
void AddBoolean (TBoolEnum key, bool initialValue)
 
void SetBoolean (TBoolEnum key, bool value)
 
bool GetBoolean (TBoolEnum key)
 
void ActivateTrigger (TTriggerEnum key)
 
void DeActivateTrigger (TTriggerEnum key)
 
bool GetTrigger (TTriggerEnum key)
 

Private Attributes

readonly Dictionary< TBoolEnum, bool > initialBooleans = new Dictionary<TBoolEnum, bool>()
 
readonly Dictionary< TBoolEnum, bool > booleans = new Dictionary<TBoolEnum, bool>()
 
readonly HashSet< TTriggerEnum > triggers = new HashSet<TTriggerEnum>()
 

Detailed Description

Contains data for a state machine with descriptive functions to improve code clarity.

Type Constraints
TBoolEnum :Enum 
TTriggerEnum :Enum 

Definition at line 9 of file StateData.cs.

Member Function Documentation

◆ ActivateTrigger()

void BGC.StateMachine.StateData< TBoolEnum, TTriggerEnum >.ActivateTrigger ( TTriggerEnum  key)
inline

Definition at line 51 of file StateData.cs.

52  {
53  triggers.Add(key);
54  }
readonly HashSet< TTriggerEnum > triggers
Definition: StateData.cs:15

◆ AddBoolean()

void BGC.StateMachine.StateData< TBoolEnum, TTriggerEnum >.AddBoolean ( TBoolEnum  key,
bool  initialValue 
)
inline

Definition at line 36 of file StateData.cs.

37  {
38  initialBooleans.Add(key, initialValue);
39  }
readonly Dictionary< TBoolEnum, bool > initialBooleans
Definition: StateData.cs:13

◆ Clear()

void BGC.StateMachine.StateData< TBoolEnum, TTriggerEnum >.Clear ( )
inline

Definition at line 30 of file StateData.cs.

31  {
32  booleans.Clear();
33  triggers.Clear();
34  }
readonly Dictionary< TBoolEnum, bool > booleans
Definition: StateData.cs:14
readonly HashSet< TTriggerEnum > triggers
Definition: StateData.cs:15

◆ DeActivateTrigger()

void BGC.StateMachine.StateData< TBoolEnum, TTriggerEnum >.DeActivateTrigger ( TTriggerEnum  key)
inline

Definition at line 56 of file StateData.cs.

57  {
58  triggers.Remove(key);
59  }
readonly HashSet< TTriggerEnum > triggers
Definition: StateData.cs:15

◆ GetBoolean()

bool BGC.StateMachine.StateData< TBoolEnum, TTriggerEnum >.GetBoolean ( TBoolEnum  key)
inline

Definition at line 46 of file StateData.cs.

47  {
48  return booleans[key];
49  }
readonly Dictionary< TBoolEnum, bool > booleans
Definition: StateData.cs:14

◆ GetTrigger()

bool BGC.StateMachine.StateData< TBoolEnum, TTriggerEnum >.GetTrigger ( TTriggerEnum  key)
inline

Definition at line 61 of file StateData.cs.

62  {
63  return triggers.Contains(key);
64  }
readonly HashSet< TTriggerEnum > triggers
Definition: StateData.cs:15

◆ Initialize()

void BGC.StateMachine.StateData< TBoolEnum, TTriggerEnum >.Initialize ( )
inline

initialize data with original booleans

Definition at line 20 of file StateData.cs.

21  {
22  Clear();
23 
24  foreach (KeyValuePair<TBoolEnum, bool> boolRow in initialBooleans)
25  {
26  booleans.Add(boolRow.Key, boolRow.Value);
27  }
28  }
readonly Dictionary< TBoolEnum, bool > initialBooleans
Definition: StateData.cs:13
readonly Dictionary< TBoolEnum, bool > booleans
Definition: StateData.cs:14

◆ SetBoolean()

void BGC.StateMachine.StateData< TBoolEnum, TTriggerEnum >.SetBoolean ( TBoolEnum  key,
bool  value 
)
inline

Definition at line 41 of file StateData.cs.

42  {
43  booleans[key] = value;
44  }
readonly Dictionary< TBoolEnum, bool > booleans
Definition: StateData.cs:14

Field Documentation

◆ booleans

readonly Dictionary<TBoolEnum, bool> BGC.StateMachine.StateData< TBoolEnum, TTriggerEnum >.booleans = new Dictionary<TBoolEnum, bool>()
private

Definition at line 14 of file StateData.cs.

◆ initialBooleans

readonly Dictionary<TBoolEnum, bool> BGC.StateMachine.StateData< TBoolEnum, TTriggerEnum >.initialBooleans = new Dictionary<TBoolEnum, bool>()
private

Definition at line 13 of file StateData.cs.

◆ triggers

readonly HashSet<TTriggerEnum> BGC.StateMachine.StateData< TBoolEnum, TTriggerEnum >.triggers = new HashSet<TTriggerEnum>()
private

Definition at line 15 of file StateData.cs.


The documentation for this class was generated from the following file: