示例#1
0
        /** Copy constructor. */
        public Skeleton(Skeleton skeleton)
        {
            if (skeleton == null)
            {
                throw new ArgumentException("skeleton cannot be null.");
            }
            Data = skeleton.Data;

            Bones = new List<Bone>(skeleton.Bones.Count);
            foreach (Bone bone in skeleton.Bones)
            {
                Bone parent = Bones[skeleton.Bones.IndexOf(bone.Parent)];
                Bones.Add(new Bone(bone, parent));
            }

            Slots = new List<Slot>(skeleton.Slots.Count);
            foreach (Slot slot in skeleton.Slots)
            {
                Bone bone = Bones[skeleton.Bones.IndexOf(slot.Bone)];
                var newSlot = new Slot(slot, this, bone);
                Slots.Add(newSlot);
            }

            DrawOrder = new List<Slot>(Slots.Count);
            foreach (Slot slot in skeleton.DrawOrder)
                DrawOrder.Add(Slots[skeleton.Slots.IndexOf(slot)]);

            Skin = skeleton.Skin;
            Color = skeleton.Color;
            Time = skeleton.Time;
        }
示例#2
0
        public Skeleton(SkeletonData data)
        {
            if (data == null)
            {
                throw new ArgumentException("data cannot be null.");
            }
            Data = data;

            Bones = new List<Bone>(data.Bones.Count);
            foreach (BoneData boneData in data.Bones)
            {
                Bone parent = boneData.Parent == null ? null : Bones[data.Bones.IndexOf(boneData.Parent)];
                Bones.Add(new Bone(boneData, parent));
            }

            Slots = new List<Slot>(data.Slots.Count);
            DrawOrder = new List<Slot>(data.Slots.Count);
            foreach (SlotData slotData in data.Slots)
            {
                Bone bone = Bones[data.Bones.IndexOf(slotData.BoneData)];
                var slot = new Slot(slotData, this, bone);
                Slots.Add(slot);
                DrawOrder.Add(slot);
            }

            Color = new Color(1, 1, 1, 1);
        }
示例#3
0
        /** Copy constructor. */
        public Slot(Slot slot, Skeleton skeleton, Bone bone)
        {
            if (slot == null)
            {
                throw new ArgumentException ("slot cannot be null.");
            }
            if (skeleton == null)
            {
                throw new ArgumentException ("skeleton cannot be null.");
            }
            if (bone == null)
            {
                throw new ArgumentException ("bone cannot be null.");
            }

            Data = slot.Data;
            this.Skeleton = skeleton;
            this.Bone = bone;
            Color = slot.Color;
            attachment = slot.attachment;
            attachmentTime = slot.attachmentTime;
        }