// (weighted) availability of activity, given state of run public override int CustomAvailability(RunState runState) { EmotionState e = runState.emotions; if (e.GetDominantEmotion() == EmotionType.frustration && e.frustration >= 10) { return(1); } return(0); }
private EmotionType ChooseEmotionType() { // only energy notes for the initial activity (tutorial) if (runManager.runState.timeSteps == 0) { return(EmotionType.None); } // choose a note type based on current emotional state EmotionState curr = runManager.runState.emotions; // for now, we are spawning all types of notes, but letting the notes themselves be suppressed (have X's) int exposedAnxiety = curr.anxiety; // activity.suppressedEmotions.Contains(EmotionType.anxiety) ? 0 : curr.anxiety; int exposedFrustration = curr.frustration; // activity.suppressedEmotions.Contains(EmotionType.frustration) ? 0 : curr.frustration; int exposedDespair = curr.despair; // activity.suppressedEmotions.Contains(EmotionType.despair) ? 0 : curr.despair; EmotionType type = EmotionType.None; // if specified, do that, else choose either energy, or an emotion (w/ weighted probability) // (ignore supressed emotions) // extra chance for the dominant emotion if (Random.Range(0, 80) < curr.GetMaxValue()) { EmotionType dominantEmotion = curr.GetDominantEmotion(); if (!activity.suppressedEmotions.Contains(dominantEmotion)) { type = dominantEmotion; } } // else just proportional to emotion value else if (Random.Range(0, 80) < exposedAnxiety) { type = EmotionType.anxiety; } else if (Random.Range(0, 80) < exposedFrustration) { type = EmotionType.frustration; } else if (Random.Range(0, 80) < exposedDespair) { type = EmotionType.despair; } return(type); }