public Actor(PortraitPackage myPackage, Emotion myEmotion, int mySlot,Vector2[] myActorPositions, Boolean myIsSpeaker)
        {
            actorPositions = myActorPositions;

            portraitPackage = myPackage;
            emotion = myEmotion;
            isSpeaker = myIsSpeaker;

            slot = mySlot;
            position = actorPositions[slot];

            //if (mySlot == 0)
            //{
            //    slot = ChatSlot.Left;
            //}
            //else if(mySlot == 1)
            //{
            //    slot = ChatSlot.LeftCenter;
            //}
            //else if (mySlot == 2)
            //{
            //    slot = ChatSlot.RightCenter;
            //}
            //else
            //{
            //    slot = ChatSlot.Right;
            //}
        }
Exemple #2
0
 public VideoFrame(DateTime time, string emotion, float emotionIntensity, string valence, float valenceIntensity)
 {
     this.time = time;
     this.emotion = Constants.ParseEmotion(emotion);
     this.emotionIntensity = emotionIntensity;
     this.valence = Constants.ParseValence(valence);
     this.valenceIntensity = valenceIntensity;
 }
Exemple #3
0
 //Deserialization constructor.
 public VideoFrame(SerializationInfo info, StreamingContext ctxt)
 {
     //Get the values from info and assign them to the appropriate properties
     time = (DateTime)info.GetValue("time", typeof(DateTime));
     emotion = (Emotion)info.GetValue("emotion", typeof(Emotion));
     emotionIntensity = (float)info.GetValue("emotionIntensity", typeof(float));
     valence = (Valence)info.GetValue("valence", typeof(Valence));
     valenceIntensity = (float)info.GetValue("valenceIntensity", typeof(float));
 }
	public override void SetEmo( Emotion emo ) {
		base.SetEmo( emo );
		
		if( emo == Emotion.Colere ) {
			//arbre en feu avec particules
			
		} else {
			//arbre de base
			
		}
	}
 public Texture2D GetTexture(Emotion myEmotion, int myLeftOrRight)
 {
     if (textures.ContainsKey(myEmotion))
     {
         return textures[myEmotion][myLeftOrRight];
     }
     else
     {
         //Woah! You better handle that null, bro!
         return missingTextureTexture;
     }
 }
 public RegularLine(XmlElement element, LineCatalogue catalogue, Conversation conversation)
     : base(element, catalogue, conversation)
 {
     text = element.GetAttribute("text");
     speakerName = element.GetAttribute("speaker");
     if (speakerName.Equals("")){
         speakerName = "Abby";
     }
     prerequisite = new Prerequisite(element.GetAttribute("prerequisite"), speakerName, conversation);
     consequence = new Consequence(element.GetAttribute("consequence"), speakerName, conversation);
     cameraAngle = CameraAngle.GetCameraAngle(element.GetAttribute("camera_angle"));
     emotion = Emotion.GetEmotion(element.GetAttribute("expression"));
     id = element.GetAttribute("id");
 }
	public void SetEmo( Emotion emo ) {
		base.SetEmo( emo );
		
		if( emo == Emotion.Colere ) {
			//Ronces
			
		} else if( emo == Emotion.Euphorie ) {
			//Lierre fleurie
			
		} else {
			//Lierre
			
		}
	}
    public GameObject SpawnNPC(SpawnPoint spawnPoint,
	                      Emotion emotion,
	                      string phrase,
	                      NPCController.CollidedWithPlayerAction collidedListener)
    {
        GameObject npcObject = spawnNPC(spawnPoint);
        NPCController npc = npcObject.GetComponent<NPCController>();
        npc.Emotion = emotion;
        if (emotion == Emotion.Mad) {
            npc.SetConflictPhrase(phrase);
        } else {
            npc.Phrase = phrase;
        }
        npc.OnCollidedWithPlayer += collidedListener;
        return npcObject;
    }
Exemple #9
0
        private void DrawEmotionsSettings()
        {
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUI.indentLevel++;
            foldOutEmotions = EditorGUILayout.Foldout(foldOutEmotions, new GUIContent("Emotions settings"));
            EditorGUI.indentLevel++;
            if (foldOutEmotions)
            {
                currentEmotionDisplay = (Emotion)EditorGUILayout.EnumPopup(new GUIContent("Emotion", "The emotion you want to edit."), currentEmotionDisplay);
                BSFacePose pose = poseDisplayer.Draw(lipSync.GetPoseFor(currentEmotionDisplay), lipSync);
                lipSync.SetEmotionPose(currentEmotionDisplay, pose);
            }

            EditorGUI.indentLevel -= 2;
            EditorGUILayout.EndVertical();
        }
Exemple #10
0
 private void HandleEmotion(Emotion previousEmotion, Emotion emotion)
 {
     Debug.Log(emotion);
     if (Progress.instance.IsLevelLoading || GameManager.instance.gameEnded || GameManager.instance.gamePaused)
     {
         return;
     }
     //TODO: Handle emotion (if bored or neutral spawn extra wave)
     if (emotion.Equals(Emotion.Happy) ||
         emotion.Equals(Emotion.Neutral) ||
         emotion.Equals(Emotion.Relaxed) ||
         emotion.Equals(Emotion.Tired))
     {
         SpawnWave();
     }
 }
	public override void SetEmo( Emotion emo ) {
		base.SetEmo( emo );
		
		if( emo == Emotion.Colere ) {
			//buisson de ronces
			
		} else {
			//buisson feuillu
			
		}
		if( _emo == Emotion.Angoisse ) {
			go.tag = "Action";
		} else {
			go.tag = "Decor";
		}
	}
        private async void AnalyzePhoto(Stream photoStream)
        {
            var emotionRecognizition = await EmotionServiceClient.RecognizeAsync(photoStream);

            Emotion = new Emotion()
            {
                Anger     = emotionRecognizition[0].Scores.Anger,
                Contempt  = emotionRecognizition[0].Scores.Contempt,
                Disgust   = emotionRecognizition[0].Scores.Disgust,
                Fear      = emotionRecognizition[0].Scores.Fear,
                Happiness = emotionRecognizition[0].Scores.Happiness,
                Neutral   = emotionRecognizition[0].Scores.Neutral,
                Sadness   = emotionRecognizition[0].Scores.Sadness,
                Surprise  = emotionRecognizition[0].Scores.Surprise
            };
        }
Exemple #13
0
 public static KeyValuePair <string, double>[] EmotionToRankedList(Emotion emotion)
 {
     return(new KeyValuePair <string, double>[]
     {
         new KeyValuePair <string, double>("Anger", emotion.Anger),
         new KeyValuePair <string, double>("Contempt", emotion.Contempt),
         new KeyValuePair <string, double>("Disgust", emotion.Disgust),
         new KeyValuePair <string, double>("Fear", emotion.Fear),
         new KeyValuePair <string, double>("Happiness", emotion.Happiness),
         new KeyValuePair <string, double>("Neutral", emotion.Neutral),
         new KeyValuePair <string, double>("Sadness", emotion.Sadness),
         new KeyValuePair <string, double>("Surprise", emotion.Surprise)
     }
            .OrderByDescending(e => e.Value)
            .ToArray());
 }
Exemple #14
0
        /// <summary> Function which submits a frame to the Emotion API. </summary>
        /// <param name="frame"> The video frame to submit. </param>
        /// <returns> A <see cref="Task{LiveCameraResult}"/> representing the asynchronous API call,
        ///     and containing the emotions returned by the API. </returns>
        private async Task <LiveCameraResult> EmotionAnalysisFunction(VideoFrame frame)
        {
            // Encode image.
            var jpg = frame.Image.ToMemoryStream(".jpg", s_jpegParams);

            // Submit image to API.
            Emotion[] emotions = null;

            // See if we have local face detections for this image.
            var localFaces = (OpenCvSharp.Rect[])frame.UserData;

            if (localFaces == null)
            {
                // If localFaces is null, we're not performing local face detection.
                // Use Cognigitve Services to do the face detection.
                Properties.Settings.Default.EmotionAPICallCount++;
                emotions = await _emotionClient.RecognizeAsync(jpg);
            }
            else if (localFaces.Count() > 0)
            {
                // If we have local face detections, we can call the API with them.
                // First, convert the OpenCvSharp rectangles.
                var rects = localFaces.Select(
                    f => new Microsoft.ProjectOxford.Common.Rectangle
                {
                    Left   = f.Left,
                    Top    = f.Top,
                    Width  = f.Width,
                    Height = f.Height
                });
                Properties.Settings.Default.EmotionAPICallCount++;
                emotions = await _emotionClient.RecognizeAsync(jpg, rects.ToArray());
            }
            else
            {
                // Local face detection found no faces; don't call Cognitive Services.
                emotions = new Emotion[0];
            }

            // Output.
            return(new LiveCameraResult
            {
                Faces = emotions.Select(e => CreateFace(e.FaceRectangle)).ToArray(),
                // Extract emotion scores from results.
                EmotionScores = emotions.Select(e => e.Scores).ToArray()
            });
        }
        private string GetEmotion(Emotion emotion)
        {
            string emotionType  = string.Empty;
            double emotionValue = 0.0;

            if (emotion.Anger > emotionValue)
            {
                emotionValue = emotion.Anger;
                emotionType  = "Anger";
            }
            if (emotion.Contempt > emotionValue)
            {
                emotionValue = emotion.Contempt;
                emotionType  = "Contempt";
            }
            if (emotion.Disgust > emotionValue)
            {
                emotionValue = emotion.Disgust;
                emotionType  = "Disgust";
            }
            if (emotion.Fear > emotionValue)
            {
                emotionValue = emotion.Fear;
                emotionType  = "Fear";
            }
            if (emotion.Happiness > emotionValue)
            {
                emotionValue = emotion.Happiness;
                emotionType  = "Happiness";
            }
            if (emotion.Neutral > emotionValue)
            {
                emotionValue = emotion.Neutral;
                emotionType  = "Neutral";
            }
            if (emotion.Sadness > emotionValue)
            {
                emotionValue = emotion.Sadness;
                emotionType  = "Sadness";
            }
            if (emotion.Surprise > emotionValue)
            {
                emotionValue = emotion.Surprise;
                emotionType  = "Surprise";
            }
            return($"{emotionType}");
        }
    // Update is called once per frame
    void Update()
    {
        newEmotion = player.feeling;
        emotion    = newEmotion;

        if (newEmotion == oldEmotion) //this is to prevent Unity from setting the same color to every object every update.
        {
            return;                   //An emotion change must occur for this to be called
        }
        if (newEmotion != oldEmotion)
        {
            switch (newEmotion)
            {
            case Emotion.Angry:
                Primary.color   = Angry[P];
                Secondary.color = Angry[S];
                Accent.color    = Angry[A];
                break;

            case Emotion.Happy:
                Primary.color   = Happy[P];
                Secondary.color = Happy[S];
                Accent.color    = Happy[A];
                break;

            case Emotion.Sad:
                Primary.color   = Sad[P];
                Secondary.color = Sad[S];
                Accent.color    = Sad[A];
                break;

            case Emotion.Scared:
                Primary.color   = Scared[P];
                Secondary.color = Scared[S];
                Accent.color    = Scared[A];
                break;

            case Emotion.Neutral:
                Primary.color   = Neutral[P];
                Secondary.color = Neutral[S];
                Accent.color    = Neutral[A];
                break;
            }

            oldEmotion = newEmotion;
        }
    }
        private static void AddEmotionValuesToDictionary(Emotion emotion, Dictionary <string, float> emotionDictionary)
        {
            const double THRESHOLD_FOR_ADDING = 0.6;

            var emotionType  = emotion.Scores.GetType();
            var propertyList = emotionType
                               .GetProperties()
                               .Select(property => new { Name = property.Name, Value = (float)property.GetValue(emotion.Scores) })
                               .Where(o => o.Value > THRESHOLD_FOR_ADDING)
                               .OrderByDescending(o => o.Value)
                               .ToList();

            foreach (var property in propertyList)
            {
                emotionDictionary.Add(property.Name, property.Value);
            }
        }
Exemple #18
0
    public void SetEmotionIntensity(Emotion emotion, float intensity)
    {
        //Turn off other Emotions
        if (useSingleEmotion)
        {
            foreach (Emotion e in emotions)
            {
                if (e != emotion && e.intensity != 0)
                {
                    e.SetIntensity(0, true);
                }
            }
        }

        //Set intensity
        emotion.intensity = intensity;
    }
Exemple #19
0
    public IEnumerator Animate(Emotion emotion, float fadeDuration, float target, bool delay = false)
    {
        //  if(delay)   yield return new WaitForSeconds(fadeDuration);

        float updatedPosition = emotion.intensity;
        var   t = 0.0f;

        while (t < 1 && (Mathf.Abs(target - updatedPosition) > 0.01f))
        {
            t += Time.deltaTime / fadeDuration;
            updatedPosition = Mathf.Lerp(updatedPosition, target, t);
            Debug.Log(emotion.name + " " + updatedPosition);
            emotion.SetIntensity(updatedPosition, true);
            yield return(new WaitForEndOfFrame());
        }
        emotion.SetIntensity(target, true);
    }
Exemple #20
0
    public bool VerifyTurnOffEmotions(Emotion emotion, float fadeDuration)
    {
        bool hasEmotionOff = false;

        if (useSingleEmotion)
        {
            foreach (Emotion e in emotions)
            {
                if (e != emotion && e.intensity != 0)
                {
                    StartCoroutine(Animate(e, fadeDuration, 0));
                    hasEmotionOff = true;
                }
            }
        }
        return(hasEmotionOff);
    }
Exemple #21
0
        private void refershEmotion(Emotion emotion)
        {
            Color[] colors = _face.beginEmotions();
            _face.doEyeAction(colors, emotion.eye);
            if (isTalk_)
            {
                _face.doMouseAction(colors, talk_);
            }
            else
            {
                _face.doMouseAction(colors, emotion.mouse);
            }

            _face.doEyebrowAction(colors, emotion.eyebrow);
            _face.doEyelidAction(colors, blink_);
            _face.endEmotions(colors);
        }
Exemple #22
0
        EmotionEnum GetEmotion(Emotion emotion)
        {
            EmotionEnum maxEmotionEnum  = EmotionEnum.Anger;
            double      maxEmotionValue = 0.0;

            if (emotion.Contempt > maxEmotionValue)
            {
                maxEmotionValue = emotion.Contempt;
                maxEmotionEnum  = EmotionEnum.Contempt;
            }
            if (emotion.Disgust > maxEmotionValue)
            {
                maxEmotionValue = emotion.Disgust;
                maxEmotionEnum  = EmotionEnum.Disgust;
            }
            if (emotion.Fear > maxEmotionValue)
            {
                maxEmotionValue = emotion.Fear;
                maxEmotionEnum  = EmotionEnum.Fear;
            }

            if (emotion.Happiness > maxEmotionValue)
            {
                maxEmotionValue = emotion.Happiness;
                maxEmotionEnum  = EmotionEnum.Happiness;
            }

            if (emotion.Neutral > maxEmotionValue)
            {
                maxEmotionValue = emotion.Neutral;
                maxEmotionEnum  = EmotionEnum.Neutral;
            }

            if (emotion.Sadness > maxEmotionValue)
            {
                maxEmotionValue = emotion.Sadness;
                maxEmotionEnum  = EmotionEnum.Sadness;
            }

            if (emotion.Surprise > maxEmotionValue)
            {
                maxEmotionValue = emotion.Surprise;
                maxEmotionEnum  = EmotionEnum.Surprise;
            }
            return(maxEmotionEnum);
        }
    private void ApplyEmotion(Emotion emotion)
    {
        switch (emotion)
        {
        case Emotion.Normal:
            eye_blink.SetActive(false);
            eye_normalL.SetActive(true);
            eye_normalR.SetActive(true);
            eye_smileL.SetActive(false);
            eye_smileR.SetActive(false);
            break;

        case Emotion.Blink:
        case Emotion.Smile:
            eye_blink.SetActive(false);
            eye_normalL.SetActive(false);
            eye_normalR.SetActive(false);
            eye_smileL.SetActive(true);
            eye_smileR.SetActive(true);
            break;

        case Emotion.Crazy:
            eye_blink.SetActive(true);
            eye_normalL.SetActive(false);
            eye_normalR.SetActive(false);
            eye_smileL.SetActive(false);
            eye_smileR.SetActive(false);
            break;

        case Emotion.WinkLeft:
            eye_blink.SetActive(false);
            eye_normalL.SetActive(false);
            eye_normalR.SetActive(true);
            eye_smileL.SetActive(true);
            eye_smileR.SetActive(false);
            break;

        case Emotion.WinkRight:
            eye_blink.SetActive(false);
            eye_normalL.SetActive(true);
            eye_normalR.SetActive(false);
            eye_smileL.SetActive(false);
            eye_smileR.SetActive(true);
            break;
        }
    }
Exemple #24
0
    /// <summary>
    /// Gets the emotion scores as list of strings.
    /// </summary>
    /// <returns>The emotion as string.</returns>
    /// <param name="emotion">Emotion.</param>
    public static List <string> GetEmotionScoresList(Emotion emotion)
    {
        List <string> alScores = new List <string>();

        if (emotion == null || emotion.scores == null)
        {
            return(alScores);
        }

        Scores es = emotion.scores;

        if (es.anger >= 0.01f)
        {
            alScores.Add(string.Format("{0:F0}% angry", es.anger * 100f));
        }
        if (es.contempt >= 0.01f)
        {
            alScores.Add(string.Format("{0:F0}% contemptuous", es.contempt * 100f));
        }
        if (es.disgust >= 0.01f)
        {
            alScores.Add(string.Format("{0:F0}% disgusted,", es.disgust * 100f));
        }
        if (es.fear >= 0.01f)
        {
            alScores.Add(string.Format("{0:F0}% scared", es.fear * 100f));
        }
        if (es.happiness >= 0.01f)
        {
            alScores.Add(string.Format("{0:F0}% happy", es.happiness * 100f));
        }
        if (es.neutral >= 0.01f)
        {
            alScores.Add(string.Format("{0:F0}% neutral", es.neutral * 100f));
        }
        if (es.sadness >= 0.01f)
        {
            alScores.Add(string.Format("{0:F0}% sad", es.sadness * 100f));
        }
        if (es.surprise >= 0.01f)
        {
            alScores.Add(string.Format("{0:F0}% surprised", es.surprise * 100f));
        }

        return(alScores);
    }
Exemple #25
0
    public bool feels(Emotion em)
    {
        // if the emotion is on the negative side
        bool is_negative = (int)em < 0.0f;

        // Receive the binary emotion index
        int index = Mathf.Abs(((int)em)) - 1;

        if (is_negative)
        {
            return(emotion((BinaryEmotion)index).Value < 0.0f);
        }
        else
        {
            return(emotion((BinaryEmotion)index).Value > 0.0f);
        }
    }
Exemple #26
0
	public override void SetEmo( Emotion emo ) {
		base.SetEmo( emo );

		if( emo == Emotion.Colere ) {
			//arbre en feu avec particules

		} else {
			//arbre de base

		}
		
		if( _emo == Emotion.Colere ) {
			go.tag = "Action";
		} else {
			go.tag = "Decor";
		}
	}
Exemple #27
0
 public static KeyValuePair <string, double> GetDominantEmotion(Emotion scores)
 {
     return(new Dictionary <string, double>()
     {
         { "Anger", scores.Anger },
         { "Contempt", scores.Contempt },
         { "Disgust", scores.Disgust },
         { "Fear", scores.Fear },
         { "Happiness", scores.Happiness },
         { "Neutral", scores.Neutral },
         { "Sadness", scores.Sadness },
         { "Surprise", scores.Surprise }
     }
            .OrderByDescending(kv => kv.Value)
            .ThenBy(kv => kv.Key)
            .First());
 }
Exemple #28
0
 //METODO CHE ASSEGNA UN'EMOZIONE ALLA FACCIA CAMBIANDO I COMPONENTI DA CAMBIARE: OCCHI, SOPRACCIGLIA E BOCCA
 public void AssignEmotion(Emotion emotion)
 {
     this.emotion = emotion;
     mouth.GetComponent <SpriteRenderer>().sprite   = Resources.Load <Sprite>("Avatar/Mouth/" + emotion.ToString());
     eyebrow.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Avatar/Eyebrow/" + gender.ToString() + emotion.ToString());
     if (emotion == Emotion.Disgusto)
     {
         eyes.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Avatar/Eyes/" + emotion.ToString());
         eyesLight.SetActive(false);
         lashes.SetActive(false);
     }
     else
     {
         eyes.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Avatar/Eyes/Default");
         eyesLight.SetActive(true);
     }
 }
Exemple #29
0
        private static string PrintEmotion(Emotion e)
        {
            var s = new[]
            {
                $"========== YOUR EMOTIONS SCORE ==========",
                $"Anger:     {PrintFloat(e.Scores.Anger)}",
                $"Contempt:  {PrintFloat(e.Scores.Contempt)}",
                $"Disgust:   {PrintFloat(e.Scores.Disgust)}",
                $"Fear:      {PrintFloat(e.Scores.Fear)}",
                $"Happiness: {PrintFloat(e.Scores.Happiness)}",
                $"Neutral:   {PrintFloat(e.Scores.Neutral)}",
                $"Sadness:   {PrintFloat(e.Scores.Sadness)}",
                $"Surprise:  {PrintFloat(e.Scores.Surprise)}"
            };

            return(String.Join("\n\r", s));
        }
Exemple #30
0
    public Color getEmotionColor(Emotion index)
    {
        switch (index)
        {
        case Emotion.ANGER:
            return(anger);

        case Emotion.JOY:
            return(joy);

        case Emotion.SURPRISE:
            return(surprise);

        default:
            return(Color.white);
        }
    }
Exemple #31
0
        /// <summary>
        /// Asynchronously recognize emotions from a picture
        /// </summary>
        public async Task <EmotionScores> RecognizeEmotions(string imageUrl, FaceRectangle faceRectangle)
        {
            Emotion emotion = (await _emotionServiceClient.RecognizeAsync(
                                   UrlHelpers.Content(Global.Host, imageUrl),
                                   new[]
            {
                new Rectangle
                {
                    Height = faceRectangle.Height,
                    Left = faceRectangle.Left,
                    Top = faceRectangle.Top,
                    Width = faceRectangle.Width
                }
            })).FirstOrDefault();

            return(emotion.ToEmotionScores());
        }
Exemple #32
0
    public void Rejected(bool rejected)
    {
        if (rejected)
        {
            // if the player tryed to quit the game, the first emotion to talk will be Anger
            m_closeCount    = 1;
            m_emotion       = Emotion.ANGER;
            m_emotionPicked = true;
        }
        else
        {
            // pick an emotion between Joy and Surprise
            PickEmotion(1);
        }

        StartCoroutine(ChangeScene("Monologue"));
    }
Exemple #33
0
    public float get(Emotion em)
    {
        // if the emotion is on the negative side
        bool is_negative = (int)em < 0.0f;

        // Receive the binary emotion index
        int index = Mathf.Abs(((int)em)) - 1;

        if (is_negative)
        {
            return(emotion((BinaryEmotion)index).Negative);
        }
        else
        {
            return(emotion((BinaryEmotion)index).Positive);
        }
    }
Exemple #34
0
    public void set(Emotion em, float by)
    {
        // if the emotion is on the negative side
        bool is_negative = (int)em < 0.0f;

        // Receive the binary emotion index
        int index = Mathf.Abs(((int)em)) - 1;

        if (is_negative)
        {
            emotion((BinaryEmotion)index).Negative = by;
        }
        else
        {
            emotion((BinaryEmotion)index).Positive = by;
        }
    }
Exemple #35
0
    public void reset_timer(Emotion em)
    {
        // if the emotion is on the negative side
        bool is_negative = (int)em < 0.0f;

        // Receive the binary emotion index
        int index = Mathf.Abs(((int)em)) - 1;

        if (is_negative)
        {
            timers[(int)index].y = 0.0f;
        }
        else
        {
            timers[(int)index].x = 0.0f;
        }
    }
    private void OnEmotionChange(Emotion lastEmotion, Emotion nextEmotion)
    {
        CurrentState = nextEmotion == Emotion.None ?
                       State.Idle : State.Emotion;

        if (nextEmotion != Emotion.None)
        {
            PlayAnimation(nextEmotion.ToString());
        }

        var e = EmotionChange;

        if (e != null)
        {
            e(lastEmotion, nextEmotion);
        }
    }
        public int WriteRapport(Emotion emotion, int x, int y)
        {
            int rapport = 0;

            Console.SetCursorPosition(x, y);
            switch (emotion)
            {
            case Emotion.Fear:
                rapport = Rapport[3]; Console.ForegroundColor = ConsoleColor.DarkGray; Console.Write("Fear"); x += 4;
                break;

            case Emotion.Trust:
                rapport = Rapport[7]; Console.ForegroundColor = ConsoleColor.Blue; Console.Write("Trust"); x += 5;
                break;

            case Emotion.Joy:
                rapport = Rapport[4]; Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("Joy"); x += 3;
                break;

            case Emotion.Anticipation:
                rapport = Rapport[1]; Console.ForegroundColor = ConsoleColor.DarkGreen; Console.Write("Anticipation"); x += 12;
                break;

            case Emotion.Anger:
                rapport = Rapport[0]; Console.ForegroundColor = ConsoleColor.DarkRed; Console.Write("Anger"); x += 5;
                break;

            case Emotion.Disgust:
                rapport = Rapport[2]; Console.ForegroundColor = ConsoleColor.Magenta; Console.Write("Disgust"); x += 7;
                break;

            case Emotion.Sadness:
                rapport = Rapport[5]; Console.ForegroundColor = ConsoleColor.DarkYellow; Console.Write("Sadness"); x += 7;
                break;

            case Emotion.Surprise:
                rapport = Rapport[6]; Console.ForegroundColor = ConsoleColor.Cyan; Console.Write("Surprise"); x += 8;
                break;
            }

            Console.SetCursorPosition(x, y);
            Console.ForegroundColor = ConsoleColor.Gray; Console.Write(":"); x += 2;
            Console.SetCursorPosition(x, y);
            x += RapportString(rapport);
            return(x);
        }
        /// <summary>
        /// Changes the emotion of the selected CaptionWord or words.
        /// </summary>
        /// <param name="e">The Emotion to set the Caption with.</param>
        public void ChangeEmotion(Emotion e)
        {
            //Determine MarkupType
            switch (CaptionTextBox.SelectionMode)
            {
            case CaptionTextBoxSelectionMode.NoSelection:
                throw new Exception("No selected caption to markup.");     //Should not happen.

            case CaptionTextBoxSelectionMode.SingleWordSelection:
                SelectedCaptionWord.Emotion = e;
                if (e == Emotion.None || e == Emotion.Unknown)
                {
                    ClearGB_Intensity();
                    GB_Intensity.Enabled = false;
                }
                else
                {
                    SetGB_Intensity(SelectedCaptionWord.Intensity);
                }
                break;

            case CaptionTextBoxSelectionMode.MultiWordSelection:
                foreach (CaptionWord cw in SelectedCaption.Words)
                {
                    if (cw.IsSelected)
                    {
                        cw.Emotion = e;
                    }                                           //Set emotion only if selected
                }

                //Clear the Intensity GB and enable/disable it based on emotion
                ClearGB_Intensity();
                if (e == Emotion.None || e == Emotion.Unknown)
                {
                    GB_Intensity.Enabled = false;
                }
                else
                {
                    GB_Intensity.Enabled = true;
                }
                break;

            default: throw new InvalidEnumArgumentException("e", e.GetHashCode(), typeof(Emotion));
            }
        }
Exemple #39
0
        // GET: Attendance/Read/. Read the attendance history of the student
        public ActionResult Read(string id)
        {
            var CurrentId = DataSourceBackend.Instance.IdentityBackend.GetCurrentStudentID(HttpContext);

            if (DataSourceBackend.Instance.IdentityBackend.BlockExecptForRole(CurrentId, UserRoleEnum.TeacherUser))
            {
                return(RedirectToAction("Login", "Admin"));
            }

            var myStudent = DataSourceBackend.Instance.StudentBackend.Read(id);

            if (myStudent == null)
            {
                return(RedirectToAction("Error", "Home"));
            }

            var myReturn = new StudentDisplayViewModel(myStudent);

            var attendanceListOrdered = myReturn.Attendance.OrderByDescending(m => m.In);

            //Deep copy Attendance list and convert time zone
            var myAttendanceModels = new List <AttendanceModel>();

            foreach (var item in attendanceListOrdered)
            {
                var myAttendance = new AttendanceModel()
                {
                    //deep copy the AttendanceModel and convert time zone
                    In         = UTCConversionsBackend.UtcToKioskTime(item.In),
                    Out        = UTCConversionsBackend.UtcToKioskTime(item.Out),
                    Id         = item.Id,
                    StudentId  = myStudent.Id,
                    Emotion    = item.Emotion,
                    EmotionUri = Emotion.GetEmotionURI(item.Emotion)
                };

                myAttendance.Id = item.Id;

                myAttendanceModels.Add(myAttendance);
            }

            myReturn.Attendance = myAttendanceModels;

            return(View(myReturn));
        }
        /// <summary>
        /// Converts <see cref="Emotion"/> to <see cref="EmotionType"/>
        /// </summary>
        /// <param name="emotion">Emotion to convert</param>
        /// <returns></returns>
        public static EmotionType GetEmotionType(Emotion emotion)
        {
            EmotionType type = default(EmotionType);

            var   scores = emotion.Scores;
            float max    = 0;

            if (scores.Contempt > max)
            {
                max  = scores.Contempt;
                type = EmotionType.Contempt;
            }
            if (scores.Disgust > max)
            {
                max  = scores.Disgust;
                type = EmotionType.Disgust;
            }
            if (scores.Fear > max)
            {
                max  = scores.Fear;
                type = EmotionType.Fear;
            }
            if (scores.Happiness > max)
            {
                max  = scores.Happiness;
                type = EmotionType.Happiness;
            }
            if (scores.Neutral > max)
            {
                max  = scores.Neutral;
                type = EmotionType.Neutral;
            }
            if (scores.Sadness > max)
            {
                max  = scores.Sadness;
                type = EmotionType.Sadness;
            }
            if (scores.Surprise > max)
            {
                max  = scores.Surprise;
                type = EmotionType.Surprise;
            }

            return(type);
        }
	public override void SetEmo( Emotion emo ) {
		base.SetEmo( emo );
		
		if( emo == Emotion.Tristesse ) {
			//l'ecureuil se cache
			
			AkSoundEngine.PostEvent("EVENT_SFX_Forest_Squirrel_Flee_Play", go );
		} else {

			transform.animation.Play("Attack");
			GameObject newProjectile =(GameObject) Instantiate(Projectile,Projectile.transform.position,Quaternion.identity);
			//newProjectile.GetComponentInChildren
			iTween.MoveTo(newProjectile	,Vector3.forward,3);

			//ecureuil qui caillasse
			
		}
	}
Exemple #42
0
 public static String PrintEmotion(Emotion emotion)
 {
     switch (emotion)
     {
         case Emotion.ANGER:
             return "Anger";
         case Emotion.CONTEMPT:
             return "Contempt";
         case Emotion.DISGUST:
             return "Disgust";
         case Emotion.FEAR:
             return "Fear";
         case Emotion.JOY:
             return "Joy";
         case Emotion.SADNESS:
             return "Sadness";
         case Emotion.SURPRISE:
             return "Suprise";
         default:
             throw new Exception("Emotion '" + emotion + "' cannot be parsed");
     }
 }
        private string outputEmotionSentence(string studentID,string emotionWord, int pos, Emotion em, ArrayList wordList, string docid,double orientation)
        {
            //在HowNet情感词中存在,输出学号,情感词,文档编号,方向,前后取20个词
            string tmp = studentID + "\t" + emotionWord + "\t" + em.ToString() + "\t" + docid + "\t"+string.Format("{0:0.000}",orientation)+"\t";
            int start = pos - 10;
            if (start < 0) { start = 0; }
            int end = pos + 10;
            if (end > wordList.Count - 1) { end = wordList.Count - 1; }

            string content = "";

            for (int j = start; j <= pos; j++)
            {
                content += ((SegWord)wordList[j]).szWord;
            }

            for (int j = pos + 1; j <= end; j++)
            {
                content += ((SegWord)wordList[j]).szWord;
            }

            tmp += content + "\r\n";
            return tmp;
        }
Exemple #44
0
 public Word(string term, WordType wordtype,Emotion emotional, double confidential)
 {
     this.szTerm = term;
     this.szWordType = wordtype;
     this.Emotional = emotional;
     this.Confidential = confidential;
 }
 public NewEmotionCreatedMessage(Emotion emotion, Agent agent)
 {
     Emotion = emotion;
     Agent = agent;
 }
 public void SetEmotion(Emotion myEmotion)
 {
     emotion = myEmotion ;
 }
 public void AddEmotionTexture(Emotion myEmotion, Texture2D[] myTextures)
 {
     textures.Add(myEmotion, myTextures);
 }
 protected void InitAnimationInfo(string animationName, WrapMode wrapMode, Emotion.BodyParts emotionBodyParts)
 {
     if (animationName == null || animationName.Equals("")){
         Debug.LogError("AbstractAction.InitAnimationInfo(): " + actor.name + ". Provide a name of the animation!");
     }
     this.animationName = animationName;
     this.wrapMode = wrapMode;
     this.emotionBodyParts = emotionBodyParts;
 }
 protected void StartAnimation(string animationName, WrapMode wrapMode, Emotion.BodyParts emotionBodyParts)
 {
     this.animationName = animationName;
     this.wrapMode = wrapMode;
     this.emotionBodyParts = emotionBodyParts;
     animator.StartAnimation(animationName, wrapMode, emotionBodyParts);
 }
Exemple #50
0
 /// Get Emotion data of the specified face and emotion.
 /// fid     The face ID, zero-based
 /// eid     The emotion identifier
 /// data    The EmotionData data structure, to be returned
 public pxcmStatus QueryEmotionData(Int32 fid, Emotion eid, out EmotionData data)
 {
     return QueryEmotionDataINT(instance, fid, eid, out data);
 }
Exemple #51
0
    void handleNPCEncounter(Emotion emotion, string phrase, NPCController npc)
    {
        canvas.sortingOrder++;

        if (emotion == Emotion.None) {
            PhraseApprover.Instance.ToggleRejectButton(false);
            StepForwardInTutorial();
        } else if (emotion == Emotion.Mad) {
            ShowCurrentSlide();
            timedTickTutorial(5f);
        }
    }
Exemple #52
0
 protected virtual void OnEmotionChanged(Emotion old, Emotion @new) {
     EmotionChanged?.Invoke(this, new FacialExpressionEventArgs(old, @new));
 }
Exemple #53
0
 public Phrase(string text, Emotion emotion)
     : this(text)
 {
     this.Emotion = emotion;
 }
 void callNPCEncounterEvent(Emotion emotion, string phrase, NPCController npc)
 {
     if (OnNPCEncounter != null) {
         OnNPCEncounter(emotion, phrase, npc);
     }
 }
	public virtual void SetEmo( Emotion emo) {
		_emo = emo;
	}
Exemple #56
0
 public void addEmotion(Emotion emotion, int p)
 {
     highSpace.addEmotion(emotion, p);
 }
Exemple #57
0
    public Mood CalculateMoodFromEmotion(Emotion InputEmotion)
    {
        Mood CalculatedMood = new Mood (0.0f, 0.0f, 0.0f);

        //Emotions: JOY, DISTRESS, HOPE, FEAR, ANGER, PRIDE, ADMIRATION, GUILT, REPROACH, LIKING, DISLIKING, UNKNOWN
        if (InputEmotion.AppraisedEmotion == Emotion.EMOTIONS.JOY) {
            CalculatedMood = new Mood (0.4f, 0.2f, 0.1f);
        } else if (InputEmotion.AppraisedEmotion == Emotion.EMOTIONS.DISTRESS) {
            CalculatedMood = new Mood (-0.4f, -0.2f, -0.5f);
        } else if (InputEmotion.AppraisedEmotion == Emotion.EMOTIONS.HOPE) {
            CalculatedMood = new Mood (0.2f, 0.2f, -0.1f);
        } else if (InputEmotion.AppraisedEmotion == Emotion.EMOTIONS.FEAR) {
            CalculatedMood = new Mood (-0.64f, 0.60f, -0.43f);
        } else if (InputEmotion.AppraisedEmotion == Emotion.EMOTIONS.ANGER) {
            CalculatedMood = new Mood (-0.51f, 0.59f, 0.25f);
        } else if (InputEmotion.AppraisedEmotion == Emotion.EMOTIONS.PRIDE) {
            CalculatedMood = new Mood (0.4f, 0.3f, 0.3f);
        } else if (InputEmotion.AppraisedEmotion == Emotion.EMOTIONS.ADMIRATION) {
            CalculatedMood = new Mood (0.5f, 0.3f, -0.2f);
        } else if (InputEmotion.AppraisedEmotion == Emotion.EMOTIONS.SHAME) {
            CalculatedMood = new Mood (-0.3f, 0.1f, -0.6f);
        } else if (InputEmotion.AppraisedEmotion == Emotion.EMOTIONS.REPROACH) {
            CalculatedMood = new Mood (-0.3f, -0.1f, 0.4f);
        } else if (InputEmotion.AppraisedEmotion == Emotion.EMOTIONS.LIKING) {
            CalculatedMood = new Mood (0.40f, 0.16f, -0.24f);
        } else if (InputEmotion.AppraisedEmotion == Emotion.EMOTIONS.DISLIKING) {
            CalculatedMood = new Mood (-0.4f, 0.2f, 0.1f);
        } else if (InputEmotion.AppraisedEmotion == Emotion.EMOTIONS.RELIEF) {
            CalculatedMood = new Mood (0.2f, -0.3f, 0.4f);
        } else if (InputEmotion.AppraisedEmotion == Emotion.EMOTIONS.DISAPPOINTMENT) {
            CalculatedMood = new Mood (-0.3f, 0.1f, -0.4f);
        } else {
            CalculatedMood = new Mood (0.0f, 0.0f, 0.0f);
        }

        return CalculatedMood;
    }
Exemple #58
0
 public void AddEmotion(Emotion e)
 {
     this.emotions.Add(e);
 }
 void scoreNPCEncounter(Emotion emotion, string phrase = null)
 {
     switch (emotion) {
         case Emotion.Mad:
             score.AngryEncounter();
             break;
         default:
             break;
     }
 }
 protected void Btn_Submit_Mood_Click(object sender, System.EventArgs e)
 {
     //Post Mood
     Emotion emotion = new Emotion();
     emotion.Mood = (Mood) Enum.Parse(typeof(Mood), Dd_List_Mood.SelectedValue);
     emotion.Stress = (RelativeRating)Enum.Parse(typeof(Mood), Dd_List_Stress.SelectedValue);
     emotion.Wellbeing = (Wellbeing)Enum.Parse(typeof(Mood), Dd_List_Wellbeing.SelectedValue);
     emotion.CommonData.Note = Txt_Mood.Text;
     PersonInfo.SelectedRecord.NewItem(emotion);
 }