Represents a player of the pendulum game. More...
Public Member Functions | |
| GamePlayer () | |
| Default constructor. | |
| void | TrackActionIntensity () |
| Tracks action intensity by pushing it onto the stack of values. | |
| bool | ActionIntensityChanged () |
| Returns flag indicating if the action intensity has changed sufficiently. | |
Properties | |
| int | SelectedIndicator [get, set] |
| Gets or sets the indicator selected for display. | |
| int | Points [get, set] |
| Gets or sets the players score. | |
| DoublePendulumHinges | ActionMarker [get, set] |
| Gets or sets the hinge to which force is applied. | |
| double | ActionIntensity [get, set] |
| Gets or sets the action intensity which is applied. | |
Represents a player of the pendulum game.
Definition at line 24 of file GamePlayer.cs.
| PendulumGame.GamePlayer.GamePlayer | ( | ) |
Default constructor.
Definition at line 70 of file GamePlayer.cs.
00071 { 00072 this.selectedIndicator = 0; 00073 this.points = 0; 00074 this.actionIntensityQueue = 00075 new Queue<double>(ActionIntensityQueueSize); 00076 this.filter = 00077 new ButterworthFilter(ButterworthFilterType.HighPass, 100, 20); 00078 this.detector = 00079 new EdgeDetector(EdgeDetectionType.Rising, 0.4); 00080 }
| bool PendulumGame.GamePlayer.ActionIntensityChanged | ( | ) |
Returns flag indicating if the action intensity has changed sufficiently.
Definition at line 167 of file GamePlayer.cs.
00168 { 00169 // Only process if we have enough samples in our queue 00170 if (this.actionIntensityQueue.Count == ActionIntensityQueueSize) 00171 { 00172 double[] samples = this.actionIntensityQueue.ToArray(); 00173 00174 // High-pass filter samples 00175 double[] filteredSamples = this.filter.Calculate(samples); 00176 00177 // Edge-detect samples 00178 double[] detectedSamples = this.detector.Calculate(samples); 00179 00180 // Return result by checking the last sample 00181 if (detectedSamples[ActionIntensityQueueSize - 1] > 0.0) 00182 { 00183 return true; 00184 } 00185 } 00186 00187 return false; 00188 }
| void PendulumGame.GamePlayer.TrackActionIntensity | ( | ) |
Tracks action intensity by pushing it onto the stack of values.
Definition at line 149 of file GamePlayer.cs.
double PendulumGame.GamePlayer.ActionIntensity [get, set] |
Gets or sets the action intensity which is applied.
Definition at line 124 of file GamePlayer.cs.
DoublePendulumHinges PendulumGame.GamePlayer.ActionMarker [get, set] |
Gets or sets the hinge to which force is applied.
Definition at line 111 of file GamePlayer.cs.
int PendulumGame.GamePlayer.Points [get, set] |
Gets or sets the players score.
Definition at line 97 of file GamePlayer.cs.
int PendulumGame.GamePlayer.SelectedIndicator [get, set] |
Gets or sets the indicator selected for display.
Definition at line 88 of file GamePlayer.cs.
1.6.2