コード例 #1
0
    private void Update()
    {
        angle += speedRotation * Time.deltaTime * ((Mathf.Abs(angle) % 360 > 250 || Mathf.Abs(angle) % 360 < 110) ? 7.5f : 1);
        transform.rotation = Quaternion.Euler(0, angle, 0);

        if (emotionSet)
        {
            if (Mathf.Abs(angle) % 360 > 300)
            {
                emotionSet = false;
            }
        }
        else
        {
            if (Mathf.Abs(angle) % 360 < 20)
            {
                ++emotion;
                if (emotion == EmotionState.Dying)
                {
                    ++emotion;
                }

                creature.FaceSwap.Swap(emotion);

                if (emotion == EmotionState.EnvyPacific)
                {
                    emotion = 0;
                }
                emotionSet = true;
            }
        }
    }
コード例 #2
0
        public void TestEmotion2()
        {
            SentEmoAnalyzer analyzer = new SentEmoAnalyzer();

            analyzer.Initialize();

            EmotionState result = analyzer.DoAnalysis(@"(Because I'm happy)
Clap along if you feel like a room without a roof
(Because I'm happy)
Clap along if you feel like happiness is the truth
(Because I'm happy)
Clap along if you know what happiness is to you
(Because I'm happy)
Clap along if you feel like that's what you wanna do

Here come bad news, talking this and that(Yeah!)
Well, give me all you got, don't hold it back (Yeah!)
Well, I should probably warn you I'll be just fine (Yeah!)
No offense to you
Don't waste your time, here's why

(Because I'm happy)
Clap along if you feel like a room without a roof
(Because I'm happy)
Clap along if you feel like happiness is the truth
(Because I'm happy)
Clap along if you know what happiness is to you
(Because I'm happy)
Clap along if you feel like that's what you wanna do");

            Assert.IsTrue(result.Sentiment >= 0);
        }
コード例 #3
0
        public void TestEmotion3()
        {
            SentEmoAnalyzer analyzer = new SentEmoAnalyzer();

            analyzer.Initialize();

            EmotionState result = analyzer.DoAnalysis(@"You and I, we're like fireworks and symphonies exploding in the sky
With you, I'm alive
Like all the missing pieces of my heart, they finally collide
So stop time right here in the moonlight
'Cause I don't ever wanna close my eyes
Without you, I feel broke
Like I'm half of a whole
Without you, I've got no hand to hold
Without you, I feel torn
Like a sail in a storm
Without you, I'm just a sad song
I'm just a sad song
With you, I fall
It's like I'm leaving all my past and silhouettes up on the wall
With you, I'm a beautiful mess
It's like we're standing hand and hand with all our fears up on the edge
So stop time right here in the moonlight
'Cause I don't ever wanna close my eyes
Without you, I feel broke
Like I'm half of a whole
Without you, I've got no hand…");

            Assert.IsFalse(result.Joy >= 0.3);
            Assert.IsFalse(result.Fear <= 0.15);
            Assert.IsFalse(result.Anger <= 0.15);
            Assert.IsFalse(result.Disgust <= 0.15);
            Assert.IsFalse(result.Sadness <= 0.15);
        }
コード例 #4
0
ファイル: SushiEmotion.cs プロジェクト: Failender/CrowdRunner
    public void changeEmotion(EmotionState state)
    {
        if(currentState != state){
            Texture2D tex = new Texture2D(0,0);

            switch (state){
            case EmotionState.HAPPY:
                tex = happyTexture;
                break;

            case EmotionState.SAD:
                tex = sadTexture;
                break;

            case EmotionState.SUPRISED:
                tex = suprisedTexture;
                break;

            case EmotionState.DEAD:
                tex = deadTexture;
                break;

            }

            objectWithMaterial.material.SetTexture ("_Diffuse", tex);
        }
    }
コード例 #5
0
    protected void OnWebCam(EmotionState[] newStates, EmotionState[] oldStates)
    {
        if (
            oldStates == null ||
            this.__currentEmotion == null ||
            ((EmotionState)oldStates[0]).GetValue((Emotion)this.__currentEmotion) * 0.9 >
            newStates[0].GetValue((Emotion)this.__currentEmotion)
            )
        {
            Emotion      highestEmotion = newStates[0].GetHighestEmotion(new[] { Emotion.Neutral });
            float        emotionValue   = newStates[0].GetValue(highestEmotion);
            EmotionState state          = newStates[0];

            emotions[Emotion.Angry]    = state.Angry;
            emotions[Emotion.Sad]      = state.Sad;
            emotions[Emotion.Happy]    = state.Happy;
            emotions[Emotion.Disgust]  = state.Disgust;
            emotions[Emotion.Surprise] = state.Surprise;
            emotions[Emotion.Fear]     = state.Fear;
            emotions[Emotion.Neutral]  = state.Neutral;

            //Debug.Log(String.Format(
            // "[Angry={0}, Sad={1}, Happy={2}, Disgust={3}, Surprise={4}, Fear={5}, Neutral={6}", state.Angry,
            //state.Sad, state.Happy, state.Disgust, state.Surprise, state.Fear, state.Neutral));
        }
    }
コード例 #6
0
    void Awake()
    {
        Debug.Assert(Singleton == null, "StateManager Singleton not null on Awake.");
        Singleton = this;

        currentState = new EmotionState();
        currentState.PrintState();
    }
コード例 #7
0
 void Awake()
 {
     name            = "Meditation";
     descriptionText = "exploring the inside";
     heightRating    = 0;
     emotionEffect   = new EmotionState(0, 0, 0);
     isBreakdown     = true;
 }
コード例 #8
0
        public void TestBasicWord()
        {
            SentEmoAnalyzer analyzer = new SentEmoAnalyzer();

            analyzer.Initialize();

            EmotionState result = analyzer.DoAnalysis("Hello World!");
        }
コード例 #9
0
 void Awake()
 {
     name            = "Do Nothing";
     descriptionText = "wait - actually nothing?";
     heightRating    = 0;
     emotionEffect   = new EmotionState(0, 0, 0);
     isUnlocked      = true;
 }
コード例 #10
0
    void Update()
    {
        if (MetabolismActive)
        {
            Age += GrowSpeed * Time.deltaTime;
            AudioBox.SetOneShotPitch(1 + 0.5f * Age - 0.25f);
        }

        if (agentCreature != null)
        {
            EmotionState deductedEmotion = Emotion.Instance.GetEmotion(agentCreature);
            if (deductedEmotion != currentEmotion && Time.time - lastTime > 1f)
            {
                currentEmotion = deductedEmotion;
                FaceSwap.Swap(deductedEmotion);
                lastTime = Time.time;

                switch (currentEmotion)
                {
                //case EmotionState.Happy : AudioBox.PlayOneShot(SoundOneShot.CreatureHappy); break;
                case EmotionState.Hungry: AudioBox.PlayOneShot(SoundOneShot.CreatureHungry); break;

                case EmotionState.Scared: PlayFearSound(); break;

                case EmotionState.Suspicious: if (UnityEngine.Random.value > 0.5f)
                    {
                        AudioBox.PlayOneShot(SoundOneShot.CreatureSuspicious);
                    }
                    break;

                case EmotionState.Agressive: AudioBox.PlayOneShot(SoundOneShot.CreatureSpotPrey); break;

                case EmotionState.Curious: AudioBox.PlayOneShot(SoundOneShot.CreatureCurious); break;

                case EmotionState.Love: AudioBox.PlayOneShot(SoundOneShot.CreatureLove); break;

                case EmotionState.Tired: AudioBox.PlayOneShot(SoundOneShot.CreatureTired); break;
                }
            }
        }

        DNADistortion.Update();

        //TODO les delegué des gauges fonctionne pas
        if (MetabolismActive)
        {
            _gauges.UpdateGauges(Time.deltaTime);
        }
        if (_gauges.Life <= 0 || _gauges.Hunger <= 0 || Age > 1)
        {
            Die();
        }

        if (UpdateSize)
        {
            transform.localScale = Vector3.one * SizeForAge;
        }
    }
コード例 #11
0
 // reset profile to defaults
 public void Reset()
 {
     initialEmotions = new EmotionState(defaultInitialEmotions);
     initialEnergy   = defaultInitialEnergy;
     energyRegen     = defaultEnergyRegen;
     energyCap       = defaultEnergyCap;
     schedule        = new List <Activity>(defaultSchedule);
     bedTime         = defaultBedTime;
 }
コード例 #12
0
 public void LoadEmotionState(EmotionState state, int count = 1)
 {
     if (!Visible)
     {
         return;
     }
     emotionState = state;
     emotionCount = count;
 }
コード例 #13
0
ファイル: Student.cs プロジェクト: Dijkstra7/AureaDashboard
 public void initialiseStudent(string name, int student_ID)
 {
     this.student_name = name;
     this.id           = student_ID.ToString();
     emotionState      = new EmotionState();
     mbmlcState        = new MbmlcState();
     cognitiveState    = new CognitiveState();
     setStatusIcons();
 }
コード例 #14
0
 void Awake()
 {
     name            = "Study";
     descriptionText = "learning and burning";
     heightRating    = 3;
     emotionEffect   = new EmotionState(8, 8, 2);
     isUnlocked      = true;
     song            = Hero.song;
 }
コード例 #15
0
ファイル: Emotion.cs プロジェクト: Lucasherfort/Eco-island
    //@ensures Retourne l'émotion de la créature en fonction de l'état des buts de l'agent
    //private EmotionState GetEmotion(Agent agent)
    public EmotionState GetEmotion(Agent agent)
    {
        if (agent.Creature.DNADistortion.HaveParticularity(typeof(Vacuum)))
        {
            if ((agent.Creature.DNADistortion.GetParticularity(typeof(Vacuum)) as Vacuum).Actif)
            {
                return(EmotionState.Swallow);
            }
        }

        if (!agent.IsThinking)
        {
            return(EmotionState.Stunned);
        }
        if (agent.Creature.isDying)
        {
            return(EmotionState.Dying);
        }


        EmotionState result;
        Goal         currentGoal = agent.IsThinking? agent.Thinking.ActiveGoal : null;

        result = GoalToEmotion(currentGoal, agent.Creature);
        GoalComposite currentCompositeGoal = currentGoal as GoalComposite;

        while (currentCompositeGoal != null)
        {
            currentGoal = currentCompositeGoal.GetActiveGoal();
            if (currentGoal != null)
            {
                EmotionState whatEmotion = GoalToEmotion(currentGoal, agent.Creature);
                if (whatEmotion != EmotionState.Default)
                {
                    result = whatEmotion;
                    break;
                }
            }
            currentCompositeGoal = currentGoal as GoalComposite;
        }


        if (result == EmotionState.Default)
        {
            if (agent.Creature.Gauges.Hunger <= agent.Creature.Gauges.Hunger.MaxSize / 4)
            {
                result = EmotionState.Hungry;
            }
            if (agent.Memory.Meals.Read().Any() || agent.Memory.Communications.Read().Any(com => Time.time - com.RegistrationDate < 3))
            {
                result = EmotionState.Happy;
            }
        }

        return(result);
    }
コード例 #16
0
ファイル: Rage.cs プロジェクト: kendallzhu/compulsive-charlie
    // (weighted) availability of activity, given state of run
    public override int CustomAvailability(RunState runState)
    {
        EmotionState e = runState.emotions;

        if (e.GetDominantEmotion() == EmotionType.frustration && e.frustration >= 10)
        {
            return(1);
        }
        return(0);
    }
コード例 #17
0
ファイル: Agent.cs プロジェクト: V4ll3V/Emotional-Agents
 public Agent(AgentModule module, AgentType type, int hp)
 {
     AgentModule        = module;
     AgentModule.Agent  = this;
     ActiveEmotions     = new List <Emotion>();
     ActiveEmotionPairs = new Dictionary <ActiveEmotionPair, float>();
     AgentType          = type;
     HP           = hp;
     EmotionState = EmotionState.resilent;
 }
コード例 #18
0
 void Awake() // haha
 {
     name            = "Sleep In";
     descriptionText = "ugh";
     heightRating    = -3;
     emotionEffect   = new EmotionState(2, 0, 6);
     isUnlocked      = true;
     song            = Luma.song;
     tempoIncrement  = .11f;
 }
コード例 #19
0
 void Awake()
 {
     name            = "Go To Bed";
     descriptionText = "it's all over";
     heightRating    = 0;
     emotionEffect   = new EmotionState(6, 0, 6);
     isUnlocked      = true;
     song            = Luma.song;
     tempoIncrement  = .11f;
 }
コード例 #20
0
 void Awake()
 {
     name            = "Shower";
     descriptionText = "pls";
     heightRating    = 0;
     emotionEffect   = new EmotionState(0, 0, 2);
     isUnlocked      = true;
     song            = Luma.song;
     tempoIncrement  = .11f;
 }
コード例 #21
0
    private IEnumerator DisplayScoreEmotion()
    {
        state = EmotionState.Score;
        yield return(new WaitForSeconds(scoreEmotionDisplayTime));

        if (state != EmotionState.Frozen || state != EmotionState.Die)
        {
            state = EmotionState.Normal;
        }
    }
コード例 #22
0
 void Awake()
 {
     name            = "Class";
     descriptionText = "I'm in school?";
     heightRating    = 1;
     emotionEffect   = new EmotionState(6, 6, 6);
     isUnlocked      = true;
     song            = WakeUpGetOutThere.song;
     tempoIncrement  = .2f;
 }
コード例 #23
0
 void Awake()
 {
     name            = "Chores";
     descriptionText = "less mess";
     heightRating    = 1;
     emotionEffect   = new EmotionState(6, 6, 6);
     isUnlocked      = true;
     song            = ReadyFreddy.song;
     tempoIncrement  = .16f;
 }
コード例 #24
0
ファイル: Agent.cs プロジェクト: V4ll3V/Emotional-Agents
 public Agent(AgentModule module, AgentType type, int hp)
 {
     AgentModule = module;
     AgentModule.Agent = this;
     ActiveEmotions = new List<Emotion>();
     ActiveEmotionPairs = new Dictionary<ActiveEmotionPair, float>();
     AgentType = type;
     HP = hp;
     EmotionState = EmotionState.resilent;
 }
コード例 #25
0
 void Awake()
 {
     name            = "Hang Out";
     descriptionText = "Talk to someone";
     heightRating    = 1;
     emotionEffect   = new EmotionState(10, 6, 6);
     isUnlocked      = true;
     song            = WakeUpGetOutThere.song;
     tempoIncrement  = .2f;
 }
コード例 #26
0
        public void TestEmotion1()
        {
            SentEmoAnalyzer analyzer = new SentEmoAnalyzer();

            analyzer.Initialize();

            EmotionState result = analyzer.DoAnalysis("I am happy that you came, Thanks for that.");

            Assert.IsTrue(result.Sentiment > 0);
        }
コード例 #27
0
 void Awake()
 {
     name            = "Exercise";
     descriptionText = "get the blood moving";
     heightRating    = 0;
     emotionEffect   = new EmotionState(0, 0, 6);
     isUnlocked      = true;
     song            = Hero.song;
     // tempoIncrement = .11f;
 }
コード例 #28
0
 void Awake()
 {
     name            = "Balanced Meal";
     descriptionText = "fruits and veggies";
     heightRating    = 3;
     emotionEffect   = new EmotionState(0, 6, 6);
     isUnlocked      = true;
     song            = ReadyFreddy.song;
     tempoIncrement  = .16f;
 }
コード例 #29
0
 // checks if state is within the thresholds
 public bool Within(EmotionState minEmotions, EmotionState maxEmotions)
 {
     return(
         anxiety >= minEmotions.anxiety &&
         anxiety <= maxEmotions.anxiety &&
         frustration >= minEmotions.frustration &&
         frustration <= maxEmotions.frustration &&
         despair >= minEmotions.despair &&
         despair <= maxEmotions.despair
         );
 }
コード例 #30
0
 // basic constructor
 public RunState(int initialEnergy, int energyCap, EmotionState initialEmotions, int bedTime)
 {
     this.timeSteps       = 0;
     this.bedTime         = bedTime;
     this.energy          = initialEnergy;
     this.energyCap       = energyCap;
     this.emotions        = initialEmotions;
     this.rhythmCombo     = 0;
     this.activityHistory = new List <ActivityPlatform>();
     this.thoughtHistory  = new List <Thought>();
 }
コード例 #31
0
 void Awake()
 {
     name            = "Video Games";
     descriptionText = "...";
     heightRating    = -1;
     emotionEffect   = new EmotionState(4, 8, 4);
     suppressedEmotions.Add(EmotionType.anxiety);
     suppressedEmotions.Add(EmotionType.despair);
     isUnlocked     = true;
     song           = Solutions.song;
     tempoIncrement = .20f;
 }
コード例 #32
0
ファイル: Rage.cs プロジェクト: kendallzhu/compulsive-charlie
 void Awake()
 {
     name            = "Rage";
     descriptionText = "overwhelming explosion of anger";
     heightRating    = 0;
     emotionEffect   = new EmotionState(0, 0, 0);
     isUnlocked      = true;
     isBreakdown     = true;
     song            = new Heartbeat(EmotionType.frustration).song;
     suppressedEmotions.Add(EmotionType.anxiety);
     suppressedEmotions.Add(EmotionType.despair);
 }
コード例 #33
0
ファイル: ImoutoFSM.cs プロジェクト: InuoeK/ImoutoProject
    private void InitializeFSM()
    {
        EmotionState neutral = new EmotionState(StateID.Neutral);
        neutral.High = 10f;
        neutral.Low = -10f;
        neutral.AddTransition(Transition.Interested, StateID.Interested);
        neutral.AddTransition(Transition.Annoyed, StateID.Annoyed);

        EmotionState interested = new EmotionState(StateID.Interested);
        interested.High = 10f;
        interested.Low = -10f;
        interested.AddTransition(Transition.Happy, StateID.Happy);
        interested.AddTransition(Transition.Annoyed, StateID.Annoyed);

        EmotionState annoyed = new EmotionState(StateID.Annoyed);
        annoyed.High = 10f;
        annoyed.Low = -10f;
        annoyed.AddTransition(Transition.Interested, StateID.Interested);
        annoyed.AddTransition(Transition.Angry, StateID.Angry);

        EmotionState angry = new EmotionState(StateID.Angry);
        angry.High = 12f;
        angry.Low = -8f;
        angry.AddTransition(Transition.Annoyed, StateID.Annoyed);
        angry.AddTransition(Transition.Lose, StateID.Lose);

        EmotionState happy = new EmotionState(StateID.Happy);
        happy.High = 10f;
        happy.AddTransition(Transition.Win, StateID.Win);

        EmotionState win = new EmotionState(StateID.Win);
        EmotionState lose = new EmotionState(StateID.Lose);

        fsm = new FSMSystem();

        fsm.AddState(neutral);
        fsm.AddState(annoyed);
        fsm.AddState(angry);
        fsm.AddState(happy);
        fsm.AddState(interested);
        fsm.AddState(lose);
        fsm.AddState(win);

        Debug.Log("Imouto FSM successfully Initialized");
    }
コード例 #34
0
 public void UpdateEmotionState(EmotionState newEmotionState)
 {
     if (newEmotionState.GetWhatToSay() == null){ // if the current emotion state was not set with a default text carry over the old emotionstate's
         newEmotionState.SetDefaultText(currentEmotion.GetWhatToSay());
     }
     currentEmotion = newEmotionState;
     if (IsInteracting()){
         GUIManager.Instance.RefreshInteraction();
     }
 }
コード例 #35
0
 protected override void Init()
 {
     currentState = new IdleState(this);
     FindInitialObjects();
     NPCManager.instance.Add(this.gameObject);
     currentEmotion = GetInitEmotionState();
     scheduleStack = new ScheduleStack();
     flagReactions = new Dictionary<string, Reaction>();
     timeReactions = new Dictionary<int, Reaction>();
     scheduleStack.Add(new DefaultSchedule(this)); // Need to add a default schedule that will never end
     SetUpSchedules();
     SetFlagReactions();
     scheduleStack.Add(GetSchedule());
 }
コード例 #36
0
ファイル: UnityChan_Ctrl.cs プロジェクト: DeanLu/SnowBall
    void OnAiEmotionChanged(EmotionState _state)
    {
        if (mEmotionState == _state || mAnim == null)
            return;

        mEmotionState = _state;

        switch(_state)
        {
        case EmotionState.Default:
            mAnim.SetInteger("EmotionType", 0);
            break;

        case EmotionState.Smile:
            mAnim.SetInteger("EmotionType", 1);
            break;

        case EmotionState.Surprise:
            mAnim.SetInteger("EmotionType", 2);
            break;

        case EmotionState.Damaged:
            mAnim.SetInteger("EmotionType", 3);
            break;
        }
    }
コード例 #37
0
 public void Perform(EmotionState toUpdate)
 {
     Debug.Log("Performing on " + toUpdate.ToString());
     GUIManager.Instance.UpdateInteractionDisplay(_reactionDialog);
 }
コード例 #38
0
 public NPCEmotionUpdateAction(NPC _npcToUpdate, EmotionState _newEmotionState)
     : base(_npcToUpdate)
 {
     newEmotionState = _newEmotionState;
 }
コード例 #39
0
 public ChangeEmotionState(Character toControl, EmotionState emotionStateToChange)
     : base(toControl)
 {
     _emotionStateToChange = emotionStateToChange;
 }