예제 #1
0
        /// <summary>
        /// Tests whether this <see cref="ARViewUpdate"/> is equal to the
        /// provided object.
        /// </summary>
        /// <param name="obj">The object to test against.</param>
        /// <returns>True if this <see cref="ARViewUpdate"/> is equal to <c>obj</c>, false otherwise.</returns>
        public override bool Equals(object obj)
        {
            if (obj == null || obj.GetType() != this.GetType())
            {
                return(false);
            }

            ARViewUpdate that = obj as ARViewUpdate;

            return(this.Id == that.Id &&
                   this.Position == that.Position &&
                   this.Rotation == that.Rotation);
        }
예제 #2
0
        /// <summary>
        /// Writes the given <see cref="ARViewUpdate"/> to a byte array.
        /// </summary>
        /// <param name="update">The <see cref="ARViewUpdate"/>, not null.</param>
        /// <returns>A byte array containing the data from the <see cref="ARViewUpdate"/>.</returns>
        public static byte[] WriteARViewUpdate(ARViewUpdate update)
        {
            Assert.IsNotNull(update);

            byte[] message = new byte[29];
            message[0] = (byte)UpdateType.UpdateARView;
            WriteInt32(update.Id, message, 1);

            WriteSingle(update.Position.x, message, 5);
            WriteSingle(update.Position.y, message, 9);
            WriteSingle(update.Position.z, message, 13);

            WriteSingle(update.Rotation.x, message, 17);
            WriteSingle(update.Rotation.y, message, 21);
            WriteSingle(update.Rotation.z, message, 25);

            return(message);
        }
예제 #3
0
 /// <summary>
 /// Called whenever a local player changes its position.
 /// </summary>
 /// <param name="update">The <see cref="ARViewUpdate"/> to send.</param>
 public void OnSendPosition(ARViewUpdate update)
 {
     this.socket.Send(MessageProcessor.WriteARViewUpdate(update));
 }