예제 #1
0
 /// <summary>
 /// Generates the appropriate FML for considering the given move.
 /// Every 2 seconds, generates the emotion only.
 /// Every 4 seconds, generates both emotion and move consideration.
 /// Interprets it instantly.
 /// </summary>
 /// <param name="move">Move to consider.</param>
 public void ConsiderMove(Move move)
 {
     if (lastTime == -1) lastTime = Time.time;
     FMLBody body = new FMLBody();
     if (Time.time >= lastTime + 4f) {
         MentalChunk mc = new MentalChunk();
         //eye movement every 4
         mc.AddFunction(new ConsiderMoveFunction(move));
         mc.owner = me;
         body.AddChunk(mc);
         body.AddChunk(getEmotion());
         interpret(body);
         lastTime = Time.time;
     } else if (Time.time >= lastTime + 2f) {
         //emotions every second
         body.AddChunk(getEmotion());
         interpret(body);
     }
 }
예제 #2
0
 /// <summary>
 /// Helper that generates an emotion function.
 /// </summary>
 /// <returns>emotion function with data from current mood</returns>
 private MentalChunk getEmotion()
 {
     MentalChunk chunk = new MentalChunk();
     chunk.AddFunction(new EmotionFunction(mood.GetArousal(), mood.GetValence()));
     chunk.owner = me;
     return chunk;
 }