Exemplo n.º 1
0
        //
        //
        //
        private bool DoNextBehaviour(float distToDest, float distToSelf, bool bDisabled)
        {
            bool result = false;

            ActionManager am = new ActionManager(m_botInstance);

            if (bDisabled == true)
            {
                if (distToDest < distToSelf)
                {
                    am.InvokeAction(Action.GoBack);
                }
                else
                {
                    Console.WriteLine("waiting for additional movement");
                }
            }
            else
            {
                if (distToSelf > distToDest)
                {
                    // enable social force
                    // enable Inter-Personal distance behaviours
                }
            }

            return(result);
        }
Exemplo n.º 2
0
        /*
         * public void OnSubscribeHandler(object sender, MessageEventArgs e)
         * {
         *  ActionManager am = new ActionManager(this);
         *  Action action = Action.None;
         *
         *  JsonReading jr = new JsonReading();
         *  jr.fromJSON(e.Message.ToString());
         *
         *  JsonReading.Value val = jr.FindValue("ACTION");
         *  Debug.WriteLine(val.m_obj.ToString());
         *
         *  action = am.GetAction(val.m_obj.ToString());
         *  am.InvokeAction(action);
         * }
         */

        /*
         * Legacy code - XMPP message handler supported by Jabber-net library.
         * This is no longer needed, but left in order for the reference how message handling works.
         * Also, helps what operations should be carried out in the message handler.
         *
         * // XMPP Message handling and perfoming actions
         * public void JabberReadMsg(object sender, Message msg)
         * {
         *  ActionManager am = new ActionManager(this);
         *  Action action = Action.None;
         *
         *  if (msg.From == "nohannara" || msg.From.ToString().Contains("mind"))
         *  {
         *      // ignore keep-alive message
         *      if (msg.Body != " ")
         *      {
         *          Console.WriteLine("RECV: " + msg.Body);
         *          //m_sensorClient.sendMessage("user2" + "@jlnetbook/smack", "Got it: " + msg.Body);
         *
         *          action = am.GetAction(msg.Body);
         *          am.InvokeAction(action);
         *      }
         *  }
         *  else
         *  {
         *      string name = m_Client.Self.FirstName;
         *      string target = "mind" + name.ElementAt(name.Length - 1) + "@jlnetbook/smack";
         *
         *      m_sensor.sendMessage(target, msg.Body);
         *  }
         * }
         */

        public void Run()
        {
            string cmd;

            ActionManager am     = new ActionManager(this);
            Action        action = Action.None;

            if (m_netManager.Login() == true)
            {
                cmd    = Console.ReadLine();
                action = am.GetAction(cmd);

                while (action != Action.Logout)
                {
                    am.InvokeAction(action);
                    cmd    = Console.ReadLine();
                    action = am.GetAction(cmd);
                }

                if (action == Action.Logout)
                {
                    m_netManager.Logout();
                }
            }
        }
Exemplo n.º 3
0
        //
        //
        //
        private bool DoNextBehaviour(float distToDest, float distToSelf, bool bDisabled)
        {
            bool result = false;

            ActionManager am = new ActionManager(m_botInstance);

            if (bDisabled == true)
            {
                if (distToDest < distToSelf)
                {
                    am.InvokeAction(Action.GoBack);
                }
                else
                {
                    Console.WriteLine("waiting for additional movement");
                }
            }
            else
            {
                if (distToSelf > distToDest)
                {
                    // enable social force
                    // enable Inter-Personal distance behaviours
                }
            }

            return result;
        }
Exemplo n.º 4
0
        /*
        public void OnSubscribeHandler(object sender, MessageEventArgs e)
        {
            ActionManager am = new ActionManager(this);
            Action action = Action.None;

            JsonReading jr = new JsonReading();
            jr.fromJSON(e.Message.ToString());

            JsonReading.Value val = jr.FindValue("ACTION");
            Debug.WriteLine(val.m_obj.ToString());

            action = am.GetAction(val.m_obj.ToString());
            am.InvokeAction(action);
        }
        */
        /*
         * Legacy code - XMPP message handler supported by Jabber-net library.
         * This is no longer needed, but left in order for the reference how message handling works.
         * Also, helps what operations should be carried out in the message handler.
         *
        // XMPP Message handling and perfoming actions
        public void JabberReadMsg(object sender, Message msg)
        {
            ActionManager am = new ActionManager(this);
            Action action = Action.None;

            if (msg.From == "nohannara" || msg.From.ToString().Contains("mind"))
            {
                // ignore keep-alive message
                if (msg.Body != " ")
                {
                    Console.WriteLine("RECV: " + msg.Body);
                    //m_sensorClient.sendMessage("user2" + "@jlnetbook/smack", "Got it: " + msg.Body);

                    action = am.GetAction(msg.Body);
                    am.InvokeAction(action);
                }
            }
            else
            {
                string name = m_Client.Self.FirstName;
                string target = "mind" + name.ElementAt(name.Length - 1) + "@jlnetbook/smack";

                m_sensor.sendMessage(target, msg.Body);
            }
        }
        */
        public void Run()
        {
            string cmd;

            ActionManager am = new ActionManager(this);
            Action action = Action.None;

            if (m_netManager.Login() == true)
            {
                cmd = Console.ReadLine();
                action = am.GetAction(cmd);

                while (action != Action.Logout)
                {
                    am.InvokeAction(action);
                    cmd = Console.ReadLine();
                    action = am.GetAction(cmd);
                }

                if (action == Action.Logout)
                {
                    m_netManager.Logout();
                }
            }
        }