Exemplo n.º 1
0
        /// <summary>
        /// Process incoming avatar animations
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="sim"></param>
        private void AvatarAnimationHandler(object sender, PacketReceivedEventArgs e)
        {
            var sim = e.Simulator;
            var packet = e.Packet;

            if (!IsMaster(sim)) return;
            AvatarAnimationPacket data = (AvatarAnimationPacket)packet;

            List<Animation> signaledAnimations = new List<Animation>(data.AnimationList.Length);

            for (int i = 0; i < data.AnimationList.Length; i++)
            {
                Animation animation = new Animation();
                animation.AnimationID = data.AnimationList[i].AnimID;
                animation.AnimationSequence = data.AnimationList[i].AnimSequenceID;
                if (i < data.AnimationSourceList.Length)
                {
                    animation.AnimationSourceObjectID = data.AnimationSourceList[i].ObjectID;
                }

                signaledAnimations.Add(animation);
            }

            Avatars_OnAvatarAnimation(this, new AvatarAnimationEventArgs(data.Sender.ID, signaledAnimations));
        }
Exemplo n.º 2
0
        internal static Animation[] ToAnimations(PackedAnimation[] packedAnimation)
        {
            Animation[] anims = new Animation[packedAnimation.Length];

            for (int i = 0; i < packedAnimation.Length; i++)
            {
                PackedAnimation packed = packedAnimation[i];
                anims[i] = new Animation { AnimID = new UUID(packed.AnimID), ObjectID = new UUID(packed.ObjectID), SequenceNum = packed.SequenceNum };
            }

            return anims;
        }
Exemplo n.º 3
0
        internal static PackedAnimation[] FromAnimations(Animation[] animations)
        {
            PackedAnimation[] anims = new PackedAnimation[animations.Length];

            for (int i = 0; i < animations.Length; i++)
            {
                Animation anim = animations[i];
                anims[i] = new PackedAnimation { AnimID = anim.AnimID.Guid, ObjectID = anim.ObjectID.Guid, SequenceNum = anim.SequenceNum };
            }

            return anims;
        }
Exemplo n.º 4
0
        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void AvatarAnimationHandler(object sender, PacketReceivedEventArgs e)
        {
            Packet packet = e.Packet;

            if (m_AvatarAnimation != null)
            {
                AvatarAnimationPacket data = (AvatarAnimationPacket)packet;

                List<Animation> signaledAnimations = new List<Animation>(data.AnimationList.Length);

                for (int i = 0; i < data.AnimationList.Length; i++)
                {
                    Animation animation = new Animation();
                    animation.AnimationID = data.AnimationList[i].AnimID;
                    animation.AnimationSequence = data.AnimationList[i].AnimSequenceID;
                    if (i < data.AnimationSourceList.Length)
                    {
                        animation.AnimationSourceObjectID = data.AnimationSourceList[i].ObjectID;
                    }

                    signaledAnimations.Add(animation);
                }

                OnAvatarAnimation(new AvatarAnimationEventArgs(data.Sender.ID, signaledAnimations));
            }
        }