Esempio n. 1
0
        /// <summary>
        ///     Get the UUID for a name
        /// </summary>
        /// <param name="name">string name</param>
        /// <returns>retuns a string UUID</returns>
        public string getUUID(string name)
        {
            string response = null;

            while (response == null)
            {
                response = findNode(name);
            }

            try
            {
                return(vr.parseData(response, new List <string> {
                    "data.data.data.components.0.uuid"
                }).ElementAt(0));
            }
            catch (Exception e)
            {
                try
                {
                    return(vr.parseData(response, new List <string> {
                        "data.data.data.uuid"
                    }).ElementAt(0));
                }
                catch (Exception f)
                {
                    return(null);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        ///     Get the height of a specific point in the VR world
        /// </summary>
        /// <param name="x">int x : the x coordinant</param>
        /// <param name="y">int y : the y coordinant</param>
        /// <returns> returns the height of the specified position in the VR world</returns>
        public int getHeight(int x, int y)
        {
            var height = 0;

            double[] position = { x, y };

            dynamic packet = new
            {
                id   = "tunnel/send",
                data = new
                {
                    dest = vr.tunnelID,
                    data = new
                    {
                        id   = "scene/terrain/getheight",
                        data = new
                        {
                            position
                        }
                    }
                }
            };
            string packetString2 = JsonConvert.SerializeObject(packet);

            vr.sendData(packetString2);
            var response = vr.dataChecker();

            try
            {
                var values = vr.parseData(response, new List <string> {
                    "data.data.data.height"
                }).ElementAt(0);

                var h = Convert.ToDouble(values);
                height = (int)h;
            }
            catch (Exception e)
            {
                Console.WriteLine("HEIGHT DIEDED " + response);
            }

            return(height);
        }