void Start() { if (instance != null && instance != this) { Destroy(this); return; } started = false; //FrameworkCore.setContent(GameInfo.vocabularyContent); DifficultyManagement.setDifficulty(Difficulty.Four); ScoresManager.AddPoints(-ScoresManager.CurrentPoints); RestTime = levelTime * 60f; Time.timeScale = 1; instance = this; StartBoard(); }
// This is where we begin trying to determine the player's affective state. private void analyzeData() { // Are we waiting between changes? if (currentDelay > 0) { currentDelay--; } else { // Do we need to update the data? if (wasWaiting) { haveRecentData = false; wasWaiting = false; // Reset stored frames to ensure we don't accidentally make judgements off them. for (int i = 0; i < lastFrames.Length; i++) { lastFrames[i] = AffectiveStates.None; } FileManagement.delayEnd(); } else { AffectiveStates update = averageState(); // Are they still in the same state? if (currentState == update) { // Only increase this if we are tracking an actual emotion if (currentState != AffectiveStates.None) { currentEmotionDuration++; } } else { // State has changed. Reset everything. currentState = update; currentEmotionDuration = 0; FileManagement.stateChange(currentState); } // Have they sustained that emotion long enough to consider it their state? if (currentEmotionDuration == EMOTIONMAX) { // Reset everything. lastState = currentState; wasWaiting = true; currentDelay = ANALYSISDELAY; currentEmotionDuration = 0; FileManagement.emotionMax(currentState); waitForWave = true; Debug.Log((int)currentState); // Determine how (if at all) we need to modify difficulty. switch (currentState) { case AffectiveStates.Boredom: curDifficulty = stepUp(); //setDifficulty(1); Debug.Log("stepUp"); break; case AffectiveStates.Frustration: curDifficulty = stepDown(); Debug.Log("stepDown"); //setDifficulty(1); break; case AffectiveStates.Flow: // If they're in Flow, don't change anything for awhile. currentDelay = ANALYSISDELAY * 3; Debug.Log("Flow"); break; } DifficultyManagement.setDifficulty(curDifficulty); } } } }