コード例 #1
0
 public People(string name, int age, EmotionalState attitude, FavoriteColor color)
 {
     _name     = name;
     _age      = age;
     _attitude = attitude;
     _color    = color;
 }
コード例 #2
0
ファイル: Person.cs プロジェクト: prbasha/RouletteSimulator
 /// <summary>
 /// Default constructor.
 /// </summary>
 public Person()
 {
     _placeBets       = true;
     _currentBet      = 0;
     _currentwinnings = 0;
     _emotionalState  = EmotionalState.Mutual;
 }
コード例 #3
0
    public void Feel(Tutor tutor)
    {
        string         moodString     = getEmotionName(tutor.Emotion);
        EmotionalState emotionalState = getStateType <EmotionalState>(moodString);

        avatarManager.Feel(tutor.Name, emotionalState, tutor.Emotion.Intensity);
    }
コード例 #4
0
 public Monster(string name, int age, EmotionalState attitude, Tribe tribe)
 {
     _name     = name;
     _age      = age;
     _attitude = attitude;
     _tribe    = tribe;
 }
コード例 #5
0
    public void Express(Tutor tutor)
    {
        string         expressionString = getEmotionName(tutor.Emotion);
        EmotionalState expressionState  = getStateType <EmotionalState>(expressionString);

        avatarManager.Express(tutor.Name, expressionState, tutor.Emotion.Intensity);
    }
コード例 #6
0
        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            base.OnStateEnter(animator, stateInfo, layerIndex);
            activationParamHash = Animator.StringToHash(activationParameterName);
            enjoymentParamHash  = Animator.StringToHash(enjoymentParameterName);

            emotionalState = animator.GetComponentInParent <EmotionalState>();
        }
コード例 #7
0
 public Monster(string name, int age, EmotionalState attitude, TribeName tribe, bool active)
 {
     _name     = name;
     _age      = age;
     _attitude = attitude;
     _tribe    = tribe;
     _active   = active;
 }
コード例 #8
0
 /// <summary>
 /// Adds to DB emotional state
 /// </summary>
 /// <param name="emotionalState"></param>
 public void AddEmotionalState(EmotionalState emotionalState)
 {
     using (PsychoCareContext db = _contextBuilder.GetContext())
     {
         db.EmotionalStates.Add(emotionalState);
         db.SaveChanges();
     }
 }
 private void Emotional_State_Should_Be_In_Db()
 {
     using (var db = new TestPsychoCareContext())
     {
         EmotionalState emotionalState = db.EmotionalStates.SingleOrDefault(x => x.UserId == 3);
         emotionalState.Should().NotBeNull();
     }
 }
コード例 #10
0
    public void UpdateEmotionalState()
    {
        stateValues[(int)EmotionalState.attention]    = attentionVal;
        stateValues[(int)EmotionalState.stress]       = stressVal;
        stateValues[(int)EmotionalState.relax]        = relaxVal;
        stateValues[(int)EmotionalState.meditation]   = meditationVal;
        stateValues[(int)EmotionalState.neutralState] = 0f;


        EmotionalState previousState = currentState;

        for (int i = 0; i < (int)EmotionalState.numEntries; i++)
        {
            if (stateValues[i] > stateValues[(int)currentState])
            {
                currentState = (EmotionalState)i;
            }
        }

        if (previousState != currentState && !audioPicker.isPlayingVO)
        {
            //This sends out an event that can let other scripts know that the emotional state
            //has been changed
            EmotionalStateChanged();

            switch (currentState)
            {
            case EmotionalState.attention:
                audioPicker.PlayAttentionClips();
                break;

            case EmotionalState.stress:
                audioPicker.PlayStressClips();
                break;

            case EmotionalState.relax:
                audioPicker.PlayRelaxClips();
                break;

            case EmotionalState.meditation:
                audioPicker.PlayMeditationClips();
                break;

            default:
                break;
            }
        }
        else
        {
            // check to see if we've passed the time limit, then repeat the audio clips

            sameStateTimer += Time.deltaTime;
            if (sameStateTimer >= sameStateRepeatTime && !audioPicker.isPlayingVO)
            {
                RepeatAudioClips();
            }
        }
    }
コード例 #11
0
    internal void Express(string name, EmotionalState expression, float intensity)
    {
        AvatarController controller = getController(name);

        if (controller == null)
        {
            return;
        }
        controller.ExpressEmotion(expression, intensity);
    }
コード例 #12
0
    internal void Feel(string name, EmotionalState emotion, float intensity)
    {
        AvatarController controller = getController(name);

        if (controller == null)
        {
            return;
        }
        controller.SetMood(emotion, intensity);
    }
コード例 #13
0
 private void Valid_Emotional_State()
 {
     _emotionalState = new EmotionalState()
     {
         EnvironmentGroupId = 3,
         UserId             = 2,
         CreationDate       = DateTime.Now,
         State = 1,
     };
 }
コード例 #14
0
 private void Emotional_State_With_0_Environment_Group_Id()
 {
     _emotionalState = new EmotionalState()
     {
         EnvironmentGroupId = 0,
         UserId             = 3,
         CreationDate       = DateTime.Now,
         State = 1,
     };
 }
コード例 #15
0
        public void AddEmotionalState([FromBody] EmotionalState emotionalState)
        {
            if (emotionalState == null)
            {
                throw new ArgumentNullException(nameof(emotionalState));
            }

            emotionalState.UserId = _webPrincipal.UserId;

            _emotionalStatesService.AddEmotionalState(emotionalState);
        }
コード例 #16
0
        public static void SendEmotionData(EmotionalState state, IPEndPoint destination)
        {
            using (var udpSender = new UdpClient())
            {
                var relaxationPacket = CreatePacket("RelaxationRate", (float)state.RelaxationRate);
                udpSender.Send(relaxationPacket, relaxationPacket.Length, destination);

                var concentrationPacket = CreatePacket("Meditation", (float)state.ConcentrationRate);
                udpSender.Send(concentrationPacket, concentrationPacket.Length, destination);
            }
        }
        private void Valid_Emotional_State()
        {
            _emotionalState = new EmotionalState()
            {
                CreationDate       = DateTime.Now,
                EnvironmentGroupId = 2,
                UserId             = 3,
                State = 2,
            };

            _webPricipalMock.Setup(x => x.UserId).Returns(3);
        }
        private void Emotional_States_Should_Equal_Inserted()
        {
            using (var db = new TestPsychoCareContext())
            {
                List <EmotionalState> emotionalStatesDb = db.EmotionalStates.Where(x => x.UserId == _userId).ToList();

                foreach (EmotionalState expectedEmotionalState in _emotionalStatesList)
                {
                    EmotionalState emotioanlStateDb = emotionalStatesDb.First(x => x.Id == expectedEmotionalState.Id);
                    emotioanlStateDb.Should().NotBeNull();
                }
            }
        }
コード例 #19
0
    // Use this for initialization
    void Start()
    {
        //osc addresses:
        //currently there are 4 locations (T3, T4, 01, 02),
        //each with /alpha, /beta, /gamma, and /theta frequencies
        //this demo scene maps 3 of the beta values to color, and the 4th to a scale value
        osc.SetAddressHandler("/Attention", AttentionToStoredFloat);
        osc.SetAddressHandler("/Stress", StressToStoredFloat);
        osc.SetAddressHandler("/Relax", RelaxToStoredFloat);
        osc.SetAddressHandler("/Meditation", MeditationToStoredFloat);

        stateValues = new float[(int)EmotionalState.numEntries];

        currentState = (EmotionalState)4;
    }
コード例 #20
0
        /// <summary>
        /// Validates and adds emotional state
        /// if added model has not vlaid datetime then uses server datetime
        /// </summary>
        /// <exception cref="ArgumentNullException"/>
        /// <exception cref="ArgumentException"/>
        public void AddEmotionalState(EmotionalState emotionalState)
        {
            if (emotionalState is null)
            {
                throw new ArgumentNullException(nameof(emotionalState));
            }

            emotionalState.Validate();

            if (emotionalState.CreationDate == DateTime.MinValue)
            {
                emotionalState.CreationDate = DateTime.Now;
            }

            _emotionalStatesRepository.AddEmotionalState(emotionalState);
        }
コード例 #21
0
        public static void SendEmotionData(EmotionalState state, IPEndPoint destination)
        {
            using (var udpSender = new UdpClient())
            {
                var relaxPacket = CreatePacket("Relax", state.Relax);
                udpSender.Send(relaxPacket, relaxPacket.Length, destination);

                var meditationPacket = CreatePacket("Meditation", state.Meditation);
                udpSender.Send(meditationPacket, meditationPacket.Length, destination);

                var attentionPacket = CreatePacket("Attention", state.Attention);
                udpSender.Send(attentionPacket, attentionPacket.Length, destination);

                var stressPacket = CreatePacket("Stress", state.Stress);
                udpSender.Send(stressPacket, stressPacket.Length, destination);
            }
        }
コード例 #22
0
 private void Emotional_State_Is_Null()
 {
     _emotionalState = null;
 }
コード例 #23
0
ファイル: Monster.cs プロジェクト: sayermas12/DnDMonsters
 public NPC(string name, int age, EmotionalState attitude)
 {
     _name     = name;
     _age      = age;
     _attitude = attitude;
 }
コード例 #24
0
 public void setEmotion(EmotionalState emotion)
 {
     Debug.Log("RHS>>> " + this.name + " emotion is changed to " + emotion + ".");
     this.emotion = emotion;
 }
コード例 #25
0
 public void ExpressEmotion(EmotionalState expression, float intensity)
 {
     parameters.setParameter(AnimatorParams.EXPRESSION_INTENSITY, intensity);
     animator.SetInteger("Expression", (int)expression);
     animator.SetTrigger("Express");
 }
コード例 #26
0
        /// Constructor for the Thing class. The objective is to create a instance of an animate agent.
        /// All the parameter defines this agent in a similar way of the super class Thing.
        /// There are just an additional parameter, named emotion, that defines the emotion state of the agent.
        ///

        public Human(long objId, string name, string tag, RGBValue color, CartesianPos pos, PhysicalState state, Material mat, string uri, EmotionalState emotion) : base(objId, name, tag, color, pos, state, mat, uri)

        {
            this.emotion = emotion;
        }
コード例 #27
0
    public void SetMood(EmotionalState mood, float intensity, float duration = 2.0f)
    {
        float finalIntensity = intensity;

        float[][] preset;

        switch (mood)
        {
        case EmotionalState.NEUTRAL:
            preset = AvatarParameters.Presets.Neutral();
            break;

        case EmotionalState.HAPPINESS:
            if (finalIntensity > LOWINTENSITYTHRESHOLD)
            {
                preset = AvatarParameters.Presets.HappinessHigh();
            }
            else
            {
                preset = AvatarParameters.Presets.HappinessLow();
            }
            break;

        case EmotionalState.SADNESS:
            if (finalIntensity > LOWINTENSITYTHRESHOLD)
            {
                preset = AvatarParameters.Presets.SadnessHigh();
            }
            else
            {
                finalIntensity = finalIntensity * 0.3f;
            }
            preset = AvatarParameters.Presets.SadnessLow();
            break;

        case EmotionalState.FEAR:
            preset = AvatarParameters.Presets.Fear();
            break;

        case EmotionalState.SURPRISE:
            preset = AvatarParameters.Presets.Surprise();
            break;

        case EmotionalState.ANGER:
        case EmotionalState.DISGUST:
        default:
            preset = AvatarParameters.Presets.Neutral();
            break;
        }

        parameters.setAllParameters <AnimatorParams>(preset[0]);
        parameters.setAllParameters <ControllerParams>(preset[1]);
        finalIntensity = finalIntensity * parameters.getMoodDampenerValue();

        if (BubbleSystemUtility.CheckCoroutine(ref corrotina))
        {
            StopCoroutine(corrotina);
        }
        corrotina = MoodTransition(animator.GetFloat("Mood Intensity"), finalIntensity, duration);
        StartCoroutine(corrotina);

        animator.SetInteger("Mood", (int)mood);

        animator.SetFloat("Desired Intensity", finalIntensity);
    }
コード例 #28
0
 public void Reset()
 {
     _emotionalState  = null;
     _thrownException = null;
 }
コード例 #29
0
    private void insertVision(GameObject go, DateTime dt)
    {
        CartesianPos     cPos      = new CartesianPos(go.transform.position.x, go.transform.position.y, go.transform.position.z);
        VisionProperties auxVision = go.GetComponent <VisionProperties>();
        Status           auxStatus = go.GetComponent <Status>();
        RGBValue         rgb;

        OntSenseCSharpAPI.Material material = OntSenseCSharpAPI.Material.unknownMaterial;
        PhysicalState state = PhysicalState.noneState;
        string        tag   = go.tag;
        string        uri   = "";

        if (auxStatus != null)
        {
            state = auxStatus.getStatus();
        }
        if (auxVision != null)
        {
            rgb      = auxVision.getRGB();
            material = auxVision.getMaterial();
            if (auxVision == vision)
            {
                tag = "SelfRobot";
            }
            uri = auxVision.getURI();
        }
        else
        {
            rgb = new RGBValue(0, 0, 0);
        }
        EmotionalState emotion    = EmotionalState.neutralEmotion;
        EmotionStatus  auxEmotion = go.GetComponent <EmotionStatus>();

        if (auxEmotion != null)
        {
            emotion = auxEmotion.getEmotion();
        }
        RobotVision rv;

        switch (go.tag)
        {
        case Constants.TAG_ROBOT:
            Robot auxRobot = new Robot(uIDD.getID(go), go.name, tag, rgb, cPos, state, material, uri);
            rv = new RobotVision(dt, auxRobot);
            break;

        case Constants.TAG_HUMAN:
            Human auxHuman = new Human(uIDD.getID(go), go.name, tag, rgb, cPos, state, material, uri, emotion);
            rv = new RobotVision(dt, auxHuman);
            break;

        default:
            Thing auxThing = new Thing(uIDD.getID(go), go.name, tag, rgb, cPos, state, material, uri);
            rv = new RobotVision(dt, auxThing);
            break;
        }
        try                                    // Try to access a resource.
        {
            rv.insert();                       // using dotNetRDF library inserts the information in the triple store
        }
        catch (Exception e)
        {
            Debug.Log("System>>> " + e.Message);                  // change for your: LogError(e);     // Call a custom error logging procedure.
        }
    }