Inheritance: BSONValue, IEnumerable
Exemplo n.º 1
0
        private void encodeArray(MemoryStream ms, BSONArray lst)
        {
            var obj = new BSONObject();

            for (int i = 0; i < lst.Count; ++i)
            {
                obj.Add(Convert.ToString(i), lst[i]);
            }

            encodeDocument(ms, obj);
        }
Exemplo n.º 2
0
		public void WriteArray()
		{
			byte[] data = MiscellaneousUtils.HexToBytes("31-00-00-00-04-42-53-4f-4e-00-26-00-00-00-02-30-00-08-00-00-00-61-77-65-73-6f-6d-65-00-01-31-00-33-33-33-33-33-33-14-40-10-32-00-c2-07-00-00-00-00");

			BSONObject obj = new BSONObject();

			obj ["BSON"] = new BSONArray ();
			obj ["BSON"].Add ("awesome");
			obj ["BSON"].Add (5.05);
			obj ["BSON"].Add (1986);

			byte[] target = SimpleBSON.Dump (obj);
			Assert.IsTrue (MiscellaneousUtils.ByteArrayCompare (target, data) == 0);

		}
Exemplo n.º 3
0
        private BSONArray decodeArray()
        {
            BSONObject obj = decodeDocument();

            int       i     = 0;
            BSONArray array = new BSONArray();

            while (obj.ContainsKey(Convert.ToString(i)))
            {
                array.Add(obj [Convert.ToString(i)]);

                i += 1;
            }

            return(array);
        }
        /// Transforms a position in world space to Bellows polar coordinates
        public BSONArray WorldToBellowsPosition(Vector3 vec)
        {
            // Transform point to be relative to whatever this Sound Master is attached to
            // (usually the camera)
            vec = transform.InverseTransformPoint(vec);

            // X value in bellows is simply polar direction
            float bellowsX = Mathf.Atan2(vec.z, vec.x) / (Mathf.PI * 2);

            // Y value in bellows is just the height
            float bellowsY = vec.y;

            // Z value in bellows is the distance to the sound, ignoring height
            float bellowsZ = Mathf.Sqrt( (vec.x * vec.x) + (vec.z * vec.z) );

            BSONArray a = new BSONArray();
            a.Add (bellowsX);
            a.Add (bellowsY);
            a.Add (bellowsZ);

            return a;
        }
		private void encodeArray(MemoryStream ms, BSONArray lst) {

			var obj = new BSONObject ();
			for(int i = 0;i < lst.Count;++i) {
				obj.Add(Convert.ToString(i), lst[i]);
			}

			encodeDocument (ms, obj);
		}
		private BSONArray decodeArray() {
			BSONObject obj = decodeDocument ();

			int i = 0;
			BSONArray array = new BSONArray ();
			while(obj.ContainsKey(Convert.ToString(i))) {
				array.Add (obj [Convert.ToString(i)]);

				i += 1;
			}

			return array;
		}
        void Awake()
        {
            // Set up BSON objects before script Start()
            bsonRoot = new BSONObject();
            bsonGlobals = new BSONObject();

            bsonChildren["load"] = new BSONArray();
            bsonChildren["play"] = new BSONArray();
            bsonChildren["move"] = new BSONArray();
            bsonChildren["volume"] = new BSONArray();
            bsonChildren["playrate"] = new BSONArray();
            bsonChildren["time"] = new BSONArray();
        }