/// <summary> /// Determines if an emotion is negative. /// </summary> /// <param name="emotion">The emotion to be checked</param> /// <returns>True if negative, false otherwise</returns> private bool IsNegativeEmotion(EmotionType emotion) { switch (emotion) { case EmotionType.Joy: case EmotionType.Pride: case EmotionType.Admiration: case EmotionType.Love: case EmotionType.Interest: case EmotionType.Gratification: case EmotionType.Gratitude: case EmotionType.Hope: case EmotionType.HappyFor: case EmotionType.Gloating: return(false); case EmotionType.Distress: case EmotionType.Shame: case EmotionType.Reproach: case EmotionType.Hate: case EmotionType.Disgust: case EmotionType.Remorse: case EmotionType.Anger: case EmotionType.Fear: case EmotionType.Resentment: case EmotionType.Pity: return(true); } return(false); }
/// <summary> /// Calculates the amount to which neuroticism affects a specified emotion /// </summary> /// <param name="et">The emotion to be evaluated</param> /// <param name="value">The intensity of the emotion</param> /// <returns>The amount to which neuroticism affects a specified emotion</returns> private double AgreeablenessFactor(EmotionType et, double value) { switch (et) { // High agreeableness = more emotions towards positive emotions towards others // Low agreeableness = opposite // (Doce et al) case EmotionType.Love: case EmotionType.HappyFor: case EmotionType.Pity: case EmotionType.Admiration: case EmotionType.Gratitude: return((Agreeableness - NEUTRAL_PERSONALITY_INTENSITY) * value); // High agreeableness = less emotions towards positive emotions towards others // Low agreeableness = opposite // (Doce et al) case EmotionType.Hate: case EmotionType.Resentment: case EmotionType.Gloating: case EmotionType.Reproach: case EmotionType.Anger: return((NEUTRAL_PERSONALITY_INTENSITY - Agreeableness) * value); default: return(0); } }
/// <summary> /// Sets up an emotion to influence the overall mood of the character based on the /// Two Dimensions of Emotion - see https://en.wikipedia.org/wiki/Emotion#/media/File:Geneva_Emotion_Wheel_-_English.png /// </summary> /// <param name="type">The type of the emotion.</param> /// <param name="value">The value of this emotion metric from 0 to 1. 0 is at the center of the model.</param> /// <param name="activationMultiplier">The impact this emotion has on the characters level of activation. 1 will mean maximum positive activation effect, 0 is no effect, -1 means maximum negative effect on activation.</param> /// <param name="enjoymentMultiplier">The impact this emotion has on the characters level of pleasure. 1 will mean maximum positive pleasure effect, 0 is no effect, -1 is the maximum negative effect on pleasure.</param> public EmotionMetric(EmotionType type, float value, float activationMultiplier, float enjoymentMultiplier) { this.type = type; this.value = value; this.activationMultiplier = activationMultiplier; this.enjoymentMultiplier = enjoymentMultiplier; }
private static float CulcDurationForType(List <Answer> answers, EmotionType type) { var filtered = answers.Where(answer => (answer.GetRight() == type) && (answer.ElapsedTime != -1.0f)); float duration = filtered.Sum(answer => answer.ElapsedTime); return(duration); }
// fonction qui permet de changer l'émotion du personnage public void ChangeEmotion(EmotionType emotion) { characterEmotion = emotion; switch (emotion) { case EmotionType.EMOTION_HAPPY: characterFaceRenderer.material.mainTextureOffset = new Vector2(0.0f, 0.5f); print("<character emotion is now HAPPY>"); break; case EmotionType.EMOTION_SAD: characterFaceRenderer.material.mainTextureOffset = new Vector2(0.5f, 0.5f); print("<character emotion is now SAD>"); break; case EmotionType.EMOTION_ANGRY: characterFaceRenderer.material.mainTextureOffset = new Vector2(0.0f, 0.0f); print("<character emotion is now ANGRY>"); break; case EmotionType.EMOTION_FLABBERGAST: characterFaceRenderer.material.mainTextureOffset = new Vector2(0.5f, 0.0f); print("<character emotion is now FLABBERGAST>"); break; } }
// fonction qui permet de changer l'émotion du personnage public void ChangeEmotion(EmotionType emotion) { characterEmotion = emotion; switch(emotion) { case EmotionType.EMOTION_HAPPY: characterFaceRenderer.material.mainTextureOffset = new Vector2(0.0f, 0.5f); print("<character emotion is now HAPPY>"); break; case EmotionType.EMOTION_SAD: characterFaceRenderer.material.mainTextureOffset = new Vector2(0.5f, 0.5f); print("<character emotion is now SAD>"); break; case EmotionType.EMOTION_ANGRY: characterFaceRenderer.material.mainTextureOffset = new Vector2(0.0f, 0.0f); print("<character emotion is now ANGRY>"); break; case EmotionType.EMOTION_FLABBERGAST: characterFaceRenderer.material.mainTextureOffset = new Vector2(0.5f, 0.0f); print("<character emotion is now FLABBERGAST>"); break; default: print("<character emotion is unkown>"); break; } }
public static float DirectionTypeToFaceApiProp(EmotionType type, EmotionScores emotion) { switch (type) { case EmotionType.Anger: return(emotion.Anger); case EmotionType.Contempt: return(emotion.Contempt); case EmotionType.Disgust: return(emotion.Disgust); case EmotionType.Fear: return(emotion.Fear); case EmotionType.Happiness: return(emotion.Happiness); case EmotionType.Neutral: return(emotion.Neutral); case EmotionType.Sadness: return(emotion.Sadness); case EmotionType.Surprise: return(emotion.Surprise); default: throw new ArgumentOutOfRangeException(); } }
public Emotion(EmotionType type, int intensity, int duration) { EmotionType = type; Intensity = intensity; Duration = duration; IsPositiveEmotion = IsPositveEmotionType(); }
public static string ToEmoji(this EmotionType type) { switch (type) { case EmotionType.Anger: return("\U0001F621"); case EmotionType.Contempt: return("\U0001F612"); case EmotionType.Disgust: return("\U0001F922"); case EmotionType.Fear: return("\U0001F631"); case EmotionType.Happiness: return("\U0001F600"); case EmotionType.Neutral: return("\U0001F610"); case EmotionType.Sadness: return("\U0001F622"); case EmotionType.Surprise: return("\U0001F62F"); default: return(""); } }
public void Play(IList <float> notes) { Random random = new Random(); foreach (var note in notes) { if (note > MaxFrequency || note < MinFrequency) { Console.WriteLine("I can't sing it!"); continue; } VoiceTimbre timbre; EmotionType emotion = (EmotionType)random.Next(0, 3); if (note >= FrequencyMapper.Instance.GetHzFromNote("D5") && emotion == EmotionType.Aggressive) { timbre = EmitScream(emotion); } else { timbre = EmitNormally(emotion); } Console.WriteLine($"Playing {FrequencyMapper.Instance.GetNoteFromHz(note)} with timbre {timbre.Emit()}"); } }
void Start() { emotePartGroup = this.transform.GetComponentInParent <EmotePartGroup>(); emoteIndex = emotePartGroup.emoteIndex; emotionType = emotePartGroup.emotionType; character = emotePartGroup.emoteUI.character; }
public double this[EmotionType et] { get { return(this[et, 0]); } }
public EmoteIndex getIndex(EmotionType emotion) { switch (emotion) { case (EmotionType.Blink): return(this.blink); case (EmotionType.Attack): return(this.attack); case (EmotionType.Hurt): return(this.hurt); case (EmotionType.Talk): return(this.talk); case (EmotionType.Emote_0): return(this.customEmote0); case (EmotionType.Emote_1): return(this.customEmote1); case (EmotionType.Emote_2): return(this.customEmote2); case (EmotionType.Emote_3): return(this.customEmote3); case (EmotionType.Emote_4): return(this.customEmote4); case (EmotionType.Emote_5): return(this.customEmote5); case (EmotionType.Emote_6): return(this.customEmote6); case (EmotionType.Emote_7): return(this.customEmote7); case (EmotionType.Emote_8): return(this.customEmote8); case (EmotionType.Emote_9): return(this.customEmote9); default: return(null); } }
/* * This method counts questions with a given emotion type */ private static ushort CountByType(List <Answer> answers, EmotionType type) { List <Answer> filtered = FilterByEmotionType(answers, type); Debug.Assert(filtered.Count() > 0, $"Expected quantity of type '{type.ToString("G")}' to be greater then 0."); return(Convert.ToUInt16(filtered.Count())); }
public void OpenType(EmotionType emotionType) { activeEmotion = emotionType; character.Emote(activeEmotion); emotionList.gameObject.SetActive(false); emotionEditor.gameObject.SetActive(true); Text title = emotionEditor.Find("Title/Type").GetComponent <Text>(); string name = character.emotes.getIndex(emotionType).name; if (!string.IsNullOrEmpty(name)) { title.text = name; } else { title.text = System.Enum.GetName(typeof(EmotionType), activeEmotion); } InputField input = emotionEditor.Find("Menu/Name/Input").GetComponent <InputField>(); input.text = character.emotes.getIndex(activeEmotion).name; if (activeEmotion >= EmotionType.Blink) { input.transform.parent.gameObject.SetActive(false); } else { input.transform.parent.gameObject.SetActive(true); } }
/// <summary> /// Calculates the amount to which neuroticism affects a specified emotion /// </summary> /// <param name="et">The emotion to be evaluated</param> /// <param name="value">The intensity of the emotion</param> /// <returns>The amount to which neuroticism affects a specified emotion</returns> private double IntroversionFactor(EmotionType et, double value) { double trueIntroversion = Introversion - NEUTRAL_PERSONALITY_INTENSITY; // Introverts tend to feel emotions more intensly, while extroverts feel emotions // less intensly but overall this effect is smaller than the other personalities (Doce et al.) return(value * trueIntroversion * 0.1); // The 0.1 has been chosen to ensure that the effect is small }
public void SubmitImageForPhoto2(EmotionType emotion) { var playerEmotionModel = new PlayerEmotionModel(Player2Name, emotion); var serializedInput = JsonConvert.SerializeObject(playerEmotionModel); App.InvokeBackdoorMethod(BackdoorMethodConstants.SubmitImageForPhoto2, serializedInput); App.WaitForElement(_photoImage2); }
public static Answer FromJSON(JSONWrappers.Answer jsonAnswer) { Question question = Question.FromJSON(jsonAnswer.Question); EmotionType userInput = Utils.EmotionTypeStringToEnum(jsonAnswer.UserInput); float elapsedTime = Convert.ToSingle(jsonAnswer.ElapsedTime, new CultureInfo("en-US")); return(new Answer(question, userInput, elapsedTime)); }
} // Time taken by the user to answer in milliseconds. -1 means "No answer" protected Answer(Question question, EmotionType userInput, float elapsedTime) { Debug.Assert((elapsedTime >= -1.0f) && (elapsedTime <= 10000.0f), "Time value must be in range -1-10000"); Question = question; UserInput = userInput; ElapsedTime = elapsedTime; }
public void SetToppingEmotion() { //for loop that randomly gives all active toppings a random emotion for (int i = 0; i < toppings.Count; i++) { EmotionType randomEmotion = (EmotionType)Random.Range(1, 10); toppings[i].GetComponent <Topping>().SetEmotion(randomEmotion); toppings[i].GetComponent <Topping>().SetEmotionWordSprite(GetComponent <EmotionHolder>().GetEmotionIcon(randomEmotion)); } }
public void Handle(EmotionType emotion) { if (emotion != EmotionType.Anger) { return; } Console.WriteLine("Yep, I can handle your anger. Keep calm mate!"); }
// copy constructor public NoteSpec(NoteSpec n) { this.timing = n.timing; this.pitch = n.pitch; this.emotionType = n.emotionType; this.elevation = n.elevation; this.instrument = n.instrument; this.lyric = n.lyric; }
public NoteSpawnSpec(float spawnTime, EmotionType type, AudioClip clip, int elevation, float volume = 1, string lyric = "") { this.spawnTime = spawnTime; this.emotionType = type; this.clip = clip; this.elevation = elevation; this.volume = volume; this.lyric = lyric; }
public EmotionPacketRequest(byte[] data) { using (var reader = new BinaryReader(new MemoryStream(data))) { Cmd = (PacketCmd)reader.ReadByte(); NetId = reader.ReadUInt32(); Id = (EmotionType)reader.ReadByte(); } }
/// <summary> /// Add to the intensity of a specific emotion in the tree /// </summary> /// <param name="et">The emotion type to add to</param> /// <param name="value">The intensity to add</param> public void addToEmotion(EmotionType et, double value) { EmotionNode node = getNode(et); if (node != null) { node.addToEmotion(et, value); } }
public static Task SubmitImageForPhoto2(string playerName, EmotionType emotion) { var player2 = new PlayerModel(PlayerNumberType.Player2, playerName) { ImageMediaFile = new MediaFile($"{Xamarin.Essentials.FileSystem.AppDataDirectory}/player2photo", () => _applicationTypeInfo.GetTypeInfo().Assembly.GetManifestResourceStream($"{_applicationTypeInfo.Namespace}.Images.{emotion}.png")) }; return(FaceOffViewModel.SubmitPhoto(emotion, player2)); }
public KeyboardTimbre PressKey(EmotionType emotion) { return(new KeyboardTimbre { Dynamic = true, EmotionType = emotion, Loud = false }); }
/// <summary> /// Change character facial expression/emote then reset to default face after a period of time. /// </summary> /// <param name="emotionType">target emotion.</param> /// <param name="duration">the duration of the emotion before resetting back to default.</param> public void Emote(EmotionType emotionType, float duration) { EmoteIndex i = emotes.getIndex(emotionType); if (isEmotingAnimationEvent) { updateAnimEmote(-1); } emote(i, duration, false); }
public void Play(IList <float> notes) { Random random = new Random(); foreach (var note in notes) { EmotionType emotion = (EmotionType)random.Next(0, 3); Console.WriteLine($"Playing {FrequencyMapper.Instance.GetNoteFromHz(note)} with timbre {PressKey(emotion).Emit()}"); } }
public VoiceTimbre EmitNormally(EmotionType emotion) { return(new VoiceTimbre { EmotionType = emotion, Loud = false, Harsh = false, Punchy = false }); }
public VoiceTimbre EmitScream(EmotionType emotion) { return(new VoiceTimbre { EmotionType = emotion, Loud = true, Harsh = false, Punchy = true }); }
/// <summary> /// 播放情緒動作(Coroutine) /// </summary> /// <param name="LavaType">毛毛蟲類型</param> /// <param name="eType">情緒類型</param> /// <returns></returns> IEnumerator PlayEmotion(PlayerType LavaType, EmotionType eType) { switch (eType) { case EmotionType.Sad: headSprite.spriteName = "Png_Ingame_Caterpillar0" + ((int)LavaType).ToString() + "_face02"; break; case EmotionType.Tired: headSprite.spriteName = "Png_Ingame_Caterpillar0" + ((int)LavaType).ToString() + "_face05"; break; case EmotionType.Singing: headSprite.spriteName = "Png_Ingame_Caterpillar0" + ((int)LavaType).ToString() + "_face06"; break; } yield return new WaitForSeconds(0.8f); state.ChangeSprite(variable.LavaType, state.CurrentState); }
/// <summary> /// Default ctor /// </summary> public NPC(string id) { this.id = id; this.name = I18nManager.Instance.Get("NPC."+id); this.emotion = EmotionType.NEUTRAL; }
/// <summary> /// The async implementation of <see cref="GetEmotions"/> /// </summary> public static void GetEmotionsAsync(AsyncCallback<Emotions> callback, EmotionType emotionType = EmotionType.Image, string language = "") { var requester = new OAuthHttpGet(APIUri.GetEmotions); if (emotionType != EmotionType.Image) { var eType = string.Empty; switch (emotionType) { case EmotionType.Image: eType = "face"; break; case EmotionType.Magic: eType = "ani"; break; case EmotionType.Cartoon: eType = "cartoon"; break; default: eType = "face"; break; } requester.Params.Add(new ParamPair("type", eType)); } if (!string.IsNullOrEmpty(language)) requester.Params.Add(new ParamPair("language", language)); requester.RequestAsync(delegate(AsyncCallResult<string> result) { ProcessAsyncCallbackResponse(result, callback, EncodeXmlCharsPreprocess); }); }
/// <summary> /// Ctor /// </summary> public UIDialog(string id, DialogType type, string storyId, string characterImage, string characterName, bool characterVisible, Dictionary<string, string> texts, Vector3 position, Vector3 npcPosition) { this.id = id; this.type = type; this.storyId = storyId; this.characterImage = characterImage; this.characterName = characterName; this.characterVisible = characterVisible; this.texts = texts; this.emotion = EmotionType.NEUTRAL; //"neutral"; this.position = position; this.npcPosition = npcPosition; }
/// <summary> /// /// </summary> /// <param name="type">表情类别,face:普通表情、ani:魔法表情、cartoon:动漫表情,默认为face。 </param> /// <param name="language">语言类别,cnname:简体、twname:繁体,默认为cnname。 </param> /// <returns></returns> public string Emotions(EmotionType type, LanguageType language) { return (Client.GetCommand("emotions", new WeiboParameter("type", type), new WeiboParameter("language", language))); }
/// <summary> /// Get string name of the emotion type /// </summary> public static string GetEmotionName(EmotionType type) { if(type == EmotionType.NEUTRAL) return "neutral"; if(type == EmotionType.POSITIVE) return "positive"; if(type == EmotionType.NEGATIVE) return "negative"; throw new System.ArgumentException("Invalid EmotionType: "+type); }
/// <summary> /// Get localized text by paramter. /// </summary> //public string GetText(string emo) public string GetText(EmotionType emo) { if(!texts.ContainsKey(GetEmotionName(emo))) { throw new Exception("Missing text for emotion:"+GetEmotionName(emo)+" in UIDialog:"+id); } string txt = I18nManager.Instance.Get(storyId+"."+texts[GetEmotionName(emo)]); //auto strip for buttons if(type == DialogType.MULTICHOICE) { //remove new line txt = txt.Replace('\n', ' '); } return txt; }
/// <summary> /// Process multi choice answer and set npc emotions /// </summary> private void ProcessSelection(string param) { UICharacter player = (UICharacter)ui.ActiveScreen.GetObject("Player"); //player.Emotion = EmotionType.NEUTRAL; if(param == "btn_MultipleChoice_Answer_Positive") { emotion = EmotionType.POSITIVE; //if(uiCharacter != null) player.Emotion = EmotionType.POSITIVE; if(playerDialog != null) playerDialog.Emotion = EmotionType.POSITIVE; // Log.GameTimes ("ProcessSelection : " + // playerdialog.Id + " " + // EmotionType.POSITIVE); GameManager.Instance.Event("DIALOG", playerDialog.Id, "answered"); if(processAnswer != null) processAnswer(playerDialog, EmotionType.POSITIVE); } else if(param == "btn_MultipleChoice_Answer_Negative") { emotion = EmotionType.NEGATIVE; if(uiCharacter != null) { player.Emotion = EmotionType.NEGATIVE; playerDialog.Emotion = EmotionType.NEGATIVE; } // Log.GameTimes ("ProcessSelection : " + // playerdialog.Id + " " + // EmotionType.NEGATIVE); GameManager.Instance.Event("DIALOG", playerDialog.Id, "answered"); if(processAnswer != null) processAnswer(playerDialog, EmotionType.NEGATIVE); } else if(param == "btn_MultipleChoice_Answer_Neutral") { emotion = EmotionType.NEUTRAL; if(uiCharacter != null) { player.Emotion = EmotionType.NEUTRAL; playerDialog.Emotion = EmotionType.NEUTRAL; } // Log.GameTimes ("ProcessSelection : " + // playerdialog.Id + " " + // EmotionType.NEUTRAL); GameManager.Instance.Event("DIALOG", playerDialog.Id, "answered"); if(processAnswer != null) processAnswer(playerDialog, EmotionType.NEUTRAL); } else { // Log.Error("Invalid param '"+param+"' in "+gameObject.name); } if(player != null && uiCharacter != null) { //player.Emotion = uiCharacter.Emotion; } }
/// <summary> /// /// </summary> /// <param name="type">表情类别,face:普通表情、ani:魔法表情、cartoon:动漫表情,默认为face。 </param> /// <param name="language">语言类别,cnname:简体、twname:繁体,默认为cnname。 </param> /// <returns></returns> public string Emotions(EmotionType type, LanguageType language) { return (Client.DoGetCommand("emotions", new RequestParam("type", type), new RequestParam("language", language))); }
public ShowPinMessage(NavMeshAgent agentMesh, EmotionType type) { AgentMesh = agentMesh; Type = type; }
/// <summary> /// Function to process the answer for multichoice dialogs /// </summary> public void ProcessMultiChoiceAnswer(UIDialog dialog, EmotionType answer) { Log.Info("Dialog "+dialog.Id+" answer:"+answer); }
public void ChangeEmotion(EmotionType faceNumber) { NPC.GetComponent<Image>().sprite = Emotion[(int)faceNumber]; }
/// <summary> /// /// </summary> /// <param name="type">表情类别,face:普通表情、ani:魔法表情、cartoon:动漫表情,默认为face。 </param> /// <param name="language">语言类别,cnname:简体、twname:繁体,默认为cnname。 </param> /// <returns></returns> public IEnumerable<Entities.status.Emotion> Emotions(EmotionType type= EmotionType.face, LanguageType language= LanguageType.cnname) { return JsonConvert.DeserializeObject<IEnumerable<Entities.status.Emotion>>(api.Emotions(type, language)); }
/// <summary> /// Process multi choice answer. /// TODO this is just an example for now, we can later improve this /// score Logic /// </summary> public void ProcessDialogAnswer(UIDialog dialog, EmotionType answer) { if(dialog.Id == "D002") { //ProcessQuestion1(answer); } else if(dialog.Id == "D006") { // ProcessQuestion2(answer); } }
/// <summary> /// /// </summary> /// <param name="type">表情类别,face:普通表情、ani:魔法表情、cartoon:动漫表情,默认为face。 </param> /// <param name="language">语言类别,cnname:简体、twname:繁体,默认为cnname。 </param> /// <returns></returns> public dynamic Emotions(EmotionType type, LanguageType language) { return DynamicJson.Parse(api.Emotions(type,language)); }
/// <summary> /// This function handle the dialogView answer from player. /// Need to override it in the screen script. /// </summary> public virtual void ProcessAnswer(UIDialog dialog, EmotionType answer) { Log.Warning("Please OVERRIDE ME!! in:"+gameObject.name); }