eMotion
 All Classes Functions Variables Enumerations
eLogic.h
1 
10 #pragma once
11 #include <eEvent.h>
12 #include <ePersonality.h>
13 #include <eKeyValue.h>
14 #include <vector>
15 #include <string>
16 
17 #define STA_FACTOR 1.f
18 #define ATT_FACTOR 1.f
20 class eLogic
21 {
22 public:
30  static bool handleEvent(ePersonality* out_personality, eEvent* eevent);
31 
38  static const eReaction * getReaction(ePersonality const * personality);
39 
40 private:
41 
42  //----------------------------------------------Phase 1-----------------------------------------------------------------//
43  // eLogic calculates the inputfeelings related to the eevent and test wise updates them with the actual mood, to get
44  // the apporiate need. The need offers an factor, whch in turn gets used in the next phase
45  //----------------------------------------------------------------------------------------------------------------------//
46 
54  static std::vector<eFeeling *> * calcInputFeelings(ePersonality const* personality, eEvent const* eevent);
55 
63  static const float* calcNeedsFactor(ePersonality const * personality, std::vector<eFeeling*> const* const inputFeelings);
64 
76  static float calcNeedMoodDif(float const factor, std::vector<eFeeling*> const* needFeelingPattern, std::vector<eFeeling*> const* mood, std::vector<eFeeling*> const * eventFeelings);
77 
78 
79  //----------------------------------------------Phase 2-----------------------------------------------------------------//
80  // In phase 2, eLogic uses the inputfeelings and the calculated factor, to update first the experience network, and then
81  // to update standards,attitudes and the mood. Here also the appraisal ends, when the updated Experience Ntwork is used
82  // to update the moo,standards and attitudes. The update of the experience Network is so a transformation form an appraisal
83  // to an experience.
84  //----------------------------------------------------------------------------------------------------------------------//
85 
96  static bool updateExperienceNetwork(ePersonality *out_personality, float factor, std::vector<eFeeling*> const* eventFeelings, eEvent const* eevent);
97 
107  static bool createNodeAndFeelings(float factor, std::vector<eFeeling*> const* const inputFeelings,eExperienceNetwork * out_expNetwork, eAkteur* akteur);
108 
118  static bool createNodeAndFeelings(float factor, std::vector<eFeeling*> const* const inputFeelings,eExperienceNetwork * out_expNetwork, eObject* object);
119 
129  static bool updateExperienceNodeFeelings(float factor, std::vector<eFeeling*> const* const inputFeelings,std::vector<eFeeling*> * const expFeelings);
138  static bool updateAttitudesStandardsMood(float factor, eEvent const * const eevent, ePersonality * const personality);
139 
140  //----------------------------------------------Phase 3-----------------------------------------------------------------//
141  // The final phase just updates the actual state of the personality by checking, if the new mood matches another
142  // reaction pattern.
143  //----------------------------------------------------------------------------------------------------------------------//
144 
151  static bool updateReactions(ePersonality *out_personality);
152 
153 
164  static float calcWeightedAverage(float oldFactor, float newFactor, float oldValue, float newValue);
165 
169  eLogic(void);
170  ~eLogic(void);
171 };
Definition: eReaction.h:18
Definition: eLogic.h:20
Definition: eAkteur.h:15
Definition: eExperienceNetwork.h:19
Definition: ePersonality.h:24
Definition: eEvent.h:16
Definition: eObject.h:15