예제 #1
0
        public void Test_RPC_ActiveEmotions()
        {
            var rpc = BuildEmotionalRPCAsset();

            PopulateEventSet(1);

            var events = new List <Name>();

            foreach (var eve in eventSets[1])
            {
                events.Add((Name)eve);
            }

            rpc.Perceive(events);


            Assert.IsNotEmpty(rpc.GetAllActiveEmotions());


            var intensity = -1.0f;

            EmotionalAppraisal.DTOs.EmotionDTO maxEmotion = new EmotionalAppraisal.DTOs.EmotionDTO();
            foreach (var e in rpc.GetAllActiveEmotions())
            {
                if (e.Intensity > intensity)
                {
                    intensity  = e.Intensity;
                    maxEmotion = e;
                }
            }


            Assert.AreEqual(maxEmotion.Type, rpc.GetStrongestActiveEmotion().EmotionType);
        }
        public void UpdateEmotionExpression()
        {
            var emotion = m_rpc.GetStrongestActiveEmotion();

            if (emotion == null)
            {
                return;
            }
            if (emotion.EmotionType == "Shame")
            {
                var emot = new EmotionalAppraisal.DTOs.EmotionDTO();
                emot.Type           = "Reproach";
                emot.Intensity      = emotion.Intensity;
                emot.CauseEventId   = emotion.CauseId;
                emot.CauseEventName = emotion.EventName.ToString();
                _body.SetExpression(emot.Type, emot.Intensity / 10f);
            }

            else
            {
                _body.SetExpression(emotion.EmotionType, emotion.Intensity / 10f);
            }
        }