コード例 #1
0
ファイル: Brain.cs プロジェクト: robbietherobot/robbie
        /// <summary>
        /// Used when Robbie wants to say something, but doesn't react on a voice command.
        /// </summary>
        /// <param name="text">The text to say.</param>
        /// <param name="emotion">The emotion to show.</param>
        /// <returns>A Task object for this method is asynchronous.</returns>
        private async Task SayTextWithEmotion(string text, string emotion)
        {
            var sayAction     = new SayAction(text);
            var emotionAction = new EmotionAction(emotion);

            var actions = new List <IAction> {
                emotionAction, sayAction
            };

            await ExecuteActions(actions);
        }
コード例 #2
0
ファイル: Brain.cs プロジェクト: robbietherobot/robbie
        /// <summary>
        /// Lets Robbie show a certain emotion.
        /// </summary>
        /// <param name="action">The emotion action containing the emotion to show.</param>
        /// <returns>A Task object for this method is asynchronous.</returns>
#pragma warning disable 1998
        private async Task Execute(EmotionAction action)
#pragma warning restore 1998
        {
            if (sleeping)
            {
                return;
            }

            eyes.ShowEmotion(action.Emotion);
            ReportEvent("eyes", $"show emotion '{action.Emotion}'");
        }
コード例 #3
0
        /// <summary>
        /// Retrieves the personalized reply from the server.
        /// </summary>
        /// <returns>A list of actions for Robbie to execute, based on the current intent.</returns>
        public override async Task <IList <IAction> > HandleIntent()
        {
            var reply = await Client.GetIntentAction(Intent.TopScoringIntent.Name);

            var sayAction   = new SayAction(reply.Reply);
            var emoteAction = new EmotionAction(reply.Emotion);

            Actions.Add(emoteAction);
            Actions.Add(sayAction);

            return(Actions);
        }