Esempio n. 1
0
        void AddEntity(string hostName, string userName, string password)
        {
            var e = new Entity();

            e["mesh"]["uri"].Suggest("resources/models/v11/nao.xml");
            e["mesh"]["visible"].Suggest(true);
            e["location"]["position"].Suggest(new Vector(XoffsetBase, 0, 0));
            e["location"]["orientation"].Suggest(new Quat((float)3.0, (float)3.0, (float)3.0, (float)10));

            XoffsetBase += 5;

            World.Instance.Add(e);

            try {
                Terminal.Instance.WriteLine("Connecting to " + userName + "@" + hostName + "...");

                var connection = new NaoConnection(hostName, userName, password);
                entRWL.AcquireWriterLock(-1);
                try {
                    entities[e] = connection;
                    connection.Start();
                } finally {
                    entRWL.ReleaseWriterLock();
                }
                Terminal.Instance.WriteLine("\tConnected :-)");
            }
            catch (Exception ex) {
                Terminal.Instance.WriteLine("\tFailed: " + ex.Message);
            }
        }
        void AddEntity(string hostName, string userName, string password)
        {
            var e = new Entity();

            e["mesh"]["uri"].Suggest("resources/models/v11/nao.xml");
            e["mesh"]["visible"].Suggest(true);
            e["location"]["position"].Suggest(new Vector(XoffsetBase, 0, 0));
            e["location"]["orientation"].Suggest(new Quat((float)3.0, (float)3.0, (float)3.0, (float)10 ));

            XoffsetBase += 5;

            World.Instance.Add(e);

            try {
                Terminal.Instance.WriteLine("Connecting to " + userName +"@"+ hostName + "...");

                var connection = new NaoConnection(hostName, userName, password);
                entRWL.AcquireWriterLock(-1);
                try {
                    entities[e] = connection;
                    connection.Start();
                } finally {
                    entRWL.ReleaseWriterLock();
                }
                Terminal.Instance.WriteLine("\tConnected :-)");
            }
            catch (Exception ex) {
                Terminal.Instance.WriteLine("\tFailed: " + ex.Message);

            }
        }