void UpdateMood() { float moodValue = popMan.GetAverageMood(population) / popMan.maxMood; gauge.fillAmount = moodValue; gauge.color = Color.Lerp(from, to, moodValue); Action <Bystander.Mood> changeMood; if (playerOptions.GetBool(Options.Option.animatedCitizens)) { if (preview == null) { preview = GameManager.instance.displayerManager.SetRotationFeed(population.prefab, face, angle, rotationSpeed, cameraDistance, FOV, 128); } changeMood = (x) => { preview.GetModel().GetComponent <Bystander>().SetEmotion(x); fitter.aspectRatio = 1f; }; } else { if (preview != null) { preview.Unstage(); preview = null; } changeMood = (x) => { face.texture = population.moodSprites[(int)x].texture; fitter.aspectRatio = population.moodSprites[0].rect.width / population.moodSprites[0].rect.height; }; } // Emotion based on humor Bystander.Mood oldMood = currentMood; if (moodValue <= angryThreshold) { currentMood = Bystander.Mood.Angry; } else if (moodValue >= happyThreshold) { currentMood = Bystander.Mood.Good; } else { currentMood = Bystander.Mood.Bad; } // SOUNDS if (oldMood != currentMood) { if (currentMood == Bystander.Mood.Good) { GameManager.instance.soundManager.Play("MoodUp"); } else if (currentMood == Bystander.Mood.Angry) { GameManager.instance.soundManager.Play("MoodDown"); } } changeMood(currentMood); moodString = loc.GetLineFromCategory("mood", currentMood.ToString().ToLower()); }