Exemplo n.º 1
0
        protected internal override void CreateItems()
        {
            var keyPos = _anteroom.Random();

            while (!passable[keyPos])
            {
                keyPos = _anteroom.Random();
            }

            Drop(new IronKey(), keyPos).HeapType = Heap.Type.Chest;

            var item = Bones.Get();

            if (item == null)
            {
                return;
            }
            int pos;

            do
            {
                pos = RoomEntrance.Random();
            }while (pos == entrance || map[pos] == Terrain.SIGN);

            Drop(item, pos).HeapType = Heap.Type.Skeleton;
        }
Exemplo n.º 2
0
        public void Write(GamePacketWriter writer)
        {
            writer.Write(Id);
            writer.Write(RealmId, 14);
            writer.WriteStringWide(Name);
            writer.Write(Race, 5);
            writer.Write(Class, 5);
            writer.Write(Sex, 2);
            writer.Write(GroupId);

            writer.Write((byte)PetIdList.Count);
            PetIdList.ForEach(e => writer.Write(e));

            writer.WriteStringWide(GuildName);
            writer.Write(GuildType, 4);

            writer.Write((byte)GuildIds.Count, 5);
            GuildIds.ForEach(e => writer.Write(e));

            writer.Write(Bones.Count, 6);
            Bones.ForEach(e => writer.Write(e));

            writer.Write(PvPFlag, 3);
            writer.Write(Unknown4C);
            writer.Write(Title, 14);
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(double id, [Bind("BurialId,BoneId,BasilarSuture,VentralArc,SubpubicAngle,SciaticNotch,PubicBone,PreaurSulcus,MedialIpRamus,DorsalPitting,ForemanMagnum,FemurHead,HumerusHead,Osteophytosis,PubicSymphysis,BoneLength,MedialClavicle,IliacCrest,FemurDiameter,Humerus,FemurLength,HumerusLength,TibiaLength,Robust,SupraorbitalRidges,OrbitEdge,ParietalBossing,Gonian,NuchalCrest,ZygomaticCrest,CranialSuture,MaximumCranialLength,MaximumCranialBreadth,BasionBregmaHeight,BasionNasion,BasionProsthionLength,BizygomaticDiameter,NasionProsthion,MaximumNasalBreadth,InterorbitalBreadth,OsteologyNotes,BurialArtifactDescription,BuriedWithArtifacts,GilesGender")] Bones bones)
        {
            if (id != bones.BoneId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bones);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BonesExists(bones.BoneId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("BurialDetails", "Home", new { burialId = bones.BurialId }));
            }
            ViewData["BurialId"] = new SelectList(_context.MainTbl, "BurialId", "BurialId", bones.BurialId);
            return(View(bones));
        }
Exemplo n.º 4
0
        public NodeBase[] CreateBoneHierarchy()
        {
            List <NodeBase> nodes = new List <NodeBase>();

            foreach (var bone in Bones)
            {
                nodes.Add(new NodeBase(bone.Name)
                {
                    Tag = bone, Icon = "/Images/Bone.png"
                });
            }

            List <NodeBase> roots = new List <NodeBase>();

            foreach (var bone in Bones)
            {
                int index = Bones.IndexOf(bone);
                if (bone.ParentIndex != -1)
                {
                    nodes[bone.ParentIndex].AddChild(nodes[index]);
                }
                else
                {
                    roots.Add(nodes[index]);
                }
            }

            return(roots.ToArray());
        }
Exemplo n.º 5
0
 public void AddBone(BVHBone Bone)
 {
     if (!Bones.Contains(Bone))
     {
         bones.Add(Bone);
     }
 }
Exemplo n.º 6
0
        public void Write(GamePacketWriter writer)
        {
            writer.Write(Id);
            writer.Write(RealmId, 14);
            writer.WriteStringWide(Name);
            writer.Write(Race, 5);
            writer.Write(Class, 5);
            writer.Write(Sex, 2);
            writer.Write(Unknown20);

            writer.Write((byte)Unknown2C.Count);
            Unknown2C.ForEach(e => writer.Write(e));

            writer.WriteStringWide(GuildName);
            writer.Write(Unknown34, 4);

            writer.Write((byte)Unknown3C.Count, 5);
            Unknown3C.ForEach(e => writer.Write(e));
            writer.Write(Bones.Count, 6);
            Bones.ForEach(e => writer.Write(e));

            writer.Write(PvPFlag, 3);
            writer.Write(Unknown4C);
            writer.Write(Title, 14);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Saves the file to the specified stream.
        /// </summary>
        /// <param name="stream">The stream to save to.</param>
        public override void Save(Stream stream)
        {
            BinaryWriter writer = new BinaryWriter(stream, Encoding.GetEncoding("us-ascii"));

            writer.WriteString(FILE_IDENTIFIER_3);
            writer.Write(Bones.Count);

            Bones.ForEach(bone => {
                writer.Write(bone.Parent);
                writer.WriteString(bone.Name);
                writer.Write((byte)0);
                writer.Write(bone.Translation);
                writer.Write(bone.Rotation, true);
            });

            writer.Write(DummyBones.Count);

            DummyBones.ForEach(dummy => {
                writer.WriteString(dummy.Name);
                writer.Write(dummy.Parent);
                writer.Write((byte)0);
                writer.Write(dummy.Translation);
                writer.Write(dummy.Rotation, true);
            });
        }
Exemplo n.º 8
0
        /// <summary>
        /// Pre-calculates chrome texture values for the model.
        /// This operation modifies the model vertices.
        /// </summary>
        private void PreCalculateChromeCoordinates()
        {
            var transforms = Bones.Select(x => x.Transform).ToList();

            foreach (var g in GetActiveMeshes().GroupBy(x => x.SkinRef))
            {
                var skin = Textures.FirstOrDefault(x => x.Index == g.Key);
                if (skin == null || (skin.Flags & 0x02) == 0)
                {
                    continue;
                }
                foreach (var v in g.SelectMany(m => m.Vertices))
                {
                    var transform = transforms[v.BoneWeightings.First().Bone.BoneIndex];

                    // Borrowed from HLMV's StudioModel::Chrome function
                    var tmp = transform.ExtractTranslation().Normalized();

                    // Using unitx for the "player right" vector
                    var up    = Vector3.Cross(tmp, Vector3.UnitX).Normalized();
                    var right = Vector3.Cross(tmp, up).Normalized();

                    // HLMV is doing an inverse rotate (no translation),
                    // so we set the shift values to zero after inverting
                    var inv = transform.Inverted();
                    inv.Row3 = Vector4.UnitW;
                    up       = Vector3.Transform(up, new Matrix3(inv));
                    right    = Vector3.Transform(right, new Matrix3(inv));

                    v.TextureU = (Vector3.Dot(v.Normal, right) + 1) * 32;
                    v.TextureV = (Vector3.Dot(v.Normal, up) + 1) * 32;
                }
            }
        }
    public WaveVR_Utils.RigidTransform GetBoneTransform(Bones bone_type)
    {
        if (AllowGetTrackingData() && WaveVR_GestureManager.Instance != null)
        {
            validPoseLeft       = handSkeletonData.left.wrist.IsValidPose;
            validPoseRight      = handSkeletonData.right.wrist.IsValidPose;
            hasHandTrackingData = WaveVR_GestureManager.Instance.GetHandSkeletonData(ref handSkeletonData);
            if (hasHandTrackingData)
            {
                if (validPoseLeft != handSkeletonData.left.wrist.IsValidPose)
                {
                    DEBUG("GetBoneTransform() left pose is " + (handSkeletonData.left.wrist.IsValidPose ? "valid." : "invalid."));
                }

                if (validPoseRight != handSkeletonData.right.wrist.IsValidPose)
                {
                    DEBUG("GetBoneTransform() right pose is " + (handSkeletonData.right.wrist.IsValidPose ? "valid." : "invalid."));
                }

                if (handSkeletonData.left.wrist.IsValidPose)
                {
                    UpdateLeftHandTrackingData();
                }

                if (handSkeletonData.right.wrist.IsValidPose)
                {
                    UpdateRightHandTrackingData();
                }
            }
        }

        return(boneDatas[(int)bone_type].GetTransform());
    }
Exemplo n.º 10
0
    private static float calculateHeight(Bones bone, float boneLength, Gender gender, int age)
    {
        float height = 0;
        float A      = age * 0.06f;

        switch (bone)
        {
        case Bones.Femur:
            height = (gender == Gender.Male) ?
                     69.089f + (2.238f * boneLength) - A :                   // Male
                     61.412f + (2.317f * boneLength) - A;                    // Female
            break;

        case Bones.Tibia:
            height = (gender == Gender.Male) ?
                     81.688f + (2.392f * boneLength) - A :                   // Male
                     72.572f + (2.533f * boneLength) - A;                    // Female
            break;

        case Bones.Humerus:
            height = (gender == Gender.Male) ?
                     73.570f + (2.970f * boneLength) - A :                   // Male
                     64.977f + (3.144f * boneLength) - A;                    // Female
            break;

        case Bones.Radius:
            height = (gender == Gender.Male) ?
                     80.405f + (3.650f * boneLength) - A :                   // Male
                     73.502f + (3.876f * boneLength) - A;                    // Female
            break;

        default: break;
        }
        return(height);
    }
Exemplo n.º 11
0
        public void SkinBones(XElement skinsData)
        {
            foreach (KeyValuePair <string, IBone> kvp in Bones)
            {
                kvp.Value.ClearSkin();
            }

            foreach (XElement skin in skinsData.Elements("bone"))
            {
                if (Bones.ContainsKey(skin.Attribute("id").Value))
                {
                    Vector2 origin = new Vector2((float)skin.Attribute("origin-x"), (float)skin.Attribute("origin-y"));

                    Rectangle frame = new Rectangle((int)skin.Attribute("frame-x"), (int)skin.Attribute("frame-y"),
                                                    (int)skin.Attribute("frame-width"), (int)skin.Attribute("frame-height"));

                    Bones[skin.Attribute("id").Value].ApplySkin(skin.Attribute("texture-name").Value, origin, frame);

                    if (skin.Element("tint") != null)
                    {
                        Bones[skin.Attribute("id").Value].MasterTint = new Color(
                            (int)skin.Element("tint").Attribute("red"),
                            (int)skin.Element("tint").Attribute("green"),
                            (int)skin.Element("tint").Attribute("blue"),
                            (int)skin.Element("tint").Attribute("alpha"));
                    }
                }
            }
        }
Exemplo n.º 12
0
        public bool Deserialize(JObject janim)
        {
            if (janim == null)
            {
                return(false);
            }


            if (janim["Frames"] != null)
            {
                FrameCount = janim["Frames"].Value <int>();
            }

            if (janim["AniPerSec"] != null)
            {
                AnimPerSec = janim["AniPerSec"].Value <float>();
            }

            if (janim["IsLoop"] != null)
            {
                IsLoop = janim["IsLoop"].Value <bool>();
            }

            foreach (JObject jbone in janim["Bones"])
            {
                CBone bone = new CBone();
                if (bone.Deserialize(jbone) == true)
                {
                    Bones.Add(bone);
                }
            }


            return(true);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Метод завершает построение экземпляра скелета
        /// </summary>
        public void FinalizeBVHSkeleton()
        {
            for (int k = 0; k < Bones.Count(); k++)
            {
                if (Bones[k].Depth > this.maxDepth)
                {
                    this.maxDepth = Bones[k].Depth;
                }

                int motionCount = 0;
                for (int n = 0; n < k; n++)
                {
                    motionCount += Bones[n].ChannelCount;
                }
                Bones[k].MotionSpace = motionCount;
                this.channels       += Bones[k].ChannelCount;

                //Получить все дочерние кости у текущей кости
                List <BVHBone> childBoneList = Bones.FindAll(i => i.Parent == Bones[k]);
                if (childBoneList.Count == 0)
                {
                    Bones[k].End = true; //Если дочерних нет, то текущая кость признается конечной
                }
                else
                {
                    Bones[k].Children = childBoneList; //Если есть, то создается список дочерних костей
                }
            }
        }
Exemplo n.º 14
0
        public bool MoveBone(int boneIndex, int newParentBoneIndex)
        {
            int newBoneIndex;

            if (boneIndex == newParentBoneIndex)
            {
                return(false);
            }

            Bones[boneIndex].Parent.Children.Remove(Bones[boneIndex]);
            Bones[boneIndex].Parent = Bones[newParentBoneIndex];
            Bones[newParentBoneIndex].Children.Add(Bones[boneIndex]);

            ModelBone bone = Bones[boneIndex];

            Bones.RemoveAt(boneIndex);
            newBoneIndex = newParentBoneIndex + (boneIndex < newParentBoneIndex ? 0 : 1);
            Bones.Insert(newBoneIndex, bone);

            ModelBone[] children = new ModelBone[Bones[newBoneIndex].Children.Count];
            Bones[newBoneIndex].Children.CopyTo(children);

            for (int i = 0; i < children.Length; i++)
            {
                MoveBone(children[i].Index, newBoneIndex);
            }

            Bones.ReIndex();

            return(true);
        }
Exemplo n.º 15
0
        public void ImportBone(ModelBone bone, int parentBoneIndex)
        {
            ModelBone           cloneBone = bone.Clone();
            ModelBoneCollection boneList  = cloneBone.AllChildren();

            ModelBone parent = Bones[parentBoneIndex];

            for (int i = 0; i < boneList.Count; i++)
            {
                Bones.Insert(parentBoneIndex + i + 1, boneList[i]);

                if (boneList[i].Mesh != null)
                {
                    ModelMesh mesh = boneList[i].Mesh;
                    mesh.Parent = boneList[i];
                    Meshes.Add(mesh);
                }

                if (i == 0)
                {
                    boneList[i].Parent = parent;
                    parent.Children.Add(boneList[i]);
                }
            }

            Bones.ReIndex();
        }
Exemplo n.º 16
0
        public override void ClearItems()
        {
            ClearSpawn();

            if (Trees != null)
            {
                List <ShadowguardCypress> list = new List <ShadowguardCypress>(Trees.Where(t => t != null && !t.Deleted));

                foreach (var tree in list)
                {
                    tree.Delete();
                }

                ColUtility.Free(list);

                ColUtility.Free(Trees);
                Trees = null;
            }

            if (Bones != null)
            {
                Bones.Delete();
                Bones = null;
            }
        }
Exemplo n.º 17
0
    protected override void FixedUpdate()
    {
        for (int i = Bones.positionCount - 1; i >= 0; i--)
        {
            Vector3 dir;
            Vector3 target;

            if (i < Bones.positionCount - 1)
            {
                target = Bones.GetPosition(i + 1);
                dir    = target - Bones.GetPosition(i);

                if (i == Bones.positionCount - 2)
                {
                    dir = target - (Bones.GetPosition(i - 1) * Weight + SubIKTarget.position * (1 - Weight));
                }
            }
            else
            {
                target = IKTarget;
                dir    = Vector3.zero;
            }

            dir.Normalize();

            var pos = target - dir * Lenght;
            pos.z = zOffset;
            Bones.SetPosition(i, pos);
        }
    }
Exemplo n.º 18
0
    internal void OnSummonPerformed(Vector3 position, float radius, float summonHP)
    {
        // find all tombstones within radius!
        Collider2D[] hitColliders = Physics2D.OverlapCircleAll(position, radius);
        int          i            = 0;

        while (i < hitColliders.Length)
        {
            Tombstone tomb = hitColliders[i].GetComponent <Tombstone>();
            if (tomb != null)
            {
                tomb.OnRessurect(summonHP);
            }
            else
            {
                Bones bones = hitColliders[i].GetComponent <Bones>();
                if (bones)
                {
                    bones.OnResurrect(summonHP);
                }
            }


            i++;
        }
    }
Exemplo n.º 19
0
 internal void Write(EndianBinaryWriter writer)
 {
     writer.ScheduleWriteOffset(16, AlignmentMode.Center, () =>
     {
         foreach (var bone in Bones)
         {
             writer.Write(bone.ID);
         }
     });
     writer.ScheduleWriteOffset(16, AlignmentMode.Center, () =>
     {
         foreach (var bone in Bones)
         {
             writer.Write(bone.Matrix);
         }
     });
     writer.ScheduleWriteOffset(16, AlignmentMode.Center, () =>
     {
         foreach (var bone in Bones)
         {
             writer.AddStringToStringTable(bone.Name);
         }
     });
     writer.ScheduleWriteOffsetIf(ExData != null, 16, AlignmentMode.Center, () => ExData.Write(writer));
     writer.Write(Bones.Count);
     writer.ScheduleWriteOffsetIf(Bones.Any(x => x.ParentID != -1), 16, AlignmentMode.Center, () =>
     {
         foreach (var bone in Bones)
         {
             writer.Write(bone.ParentID);
         }
     });
     writer.WriteNulls(writer.AddressSpace == AddressSpace.Int64 ? 32 : 40);
 }
Exemplo n.º 20
0
        public void NewBoneAnim()
        {
            var boneAnim = new BoneAnimNode("NewBoneTarget", true);

            if (Nodes.Count <= 0)
            {
                foreach (var bone in Bones)
                {
                    Nodes.Add(bone);
                }
                this.Expand();
            }

            Nodes.Add(boneAnim);
            Bones.Add(boneAnim);

            if (SkeletalAnimU != null)
            {
                boneAnim.BoneAnimU = new ResU.BoneAnim()
                {
                    Name = boneAnim.Text
                };
            }
            else
            {
                boneAnim.BoneAnim = new BoneAnim()
                {
                    Name = boneAnim.Text
                };
            }
        }
Exemplo n.º 21
0
        protected virtual Serializer Deserialize(Serializer serializer)
        {
            Bones.Clear();
            PrimaryBoneID = "";

            List <XElement> subObjects = (from el
                                          in serializer.SerializedData.Elements("dataitem").Elements("object")
                                          select el).ToList();

            for (int i = 0; i < subObjects.Count; i++)
            {
                if ((Type.GetType((string)subObjects[i].Attribute("type")) != null) &&
                    (Type.GetType((string)subObjects[i].Attribute("type")).GetInterfaces().Contains(typeof(IBone))))
                {
                    ReinstateBone(subObjects[i]);
                }
            }

            WorldPosition = serializer.GetDataItem <Vector2>("world-position");
            Rotation      = serializer.GetDataItem <float>("rotation");
            Scale         = serializer.GetDataItem <float>("scale");
            Mirror        = serializer.GetDataItem <bool>("mirror");
            Tint          = serializer.GetDataItem <Color>("tint");
            RenderDepth   = serializer.GetDataItem <float>("render-depth");
            RenderLayer   = serializer.GetDataItem <int>("render-layer");
            Visible       = serializer.GetDataItem <bool>("visible");

            return(serializer);
        }
Exemplo n.º 22
0
        private void LoadAnimations(BinaryReader reader)
        {
            var bones = ReadArrayOf <M2Bone>(reader, mHeader.OfsBones, mHeader.NBones);

            Bones = bones.Select(b => new M2AnimationBone(this, ref b, reader)).ToArray();

            if (Bones.Any(b => b.IsBillboarded))
            {
                NeedsPerInstanceAnimation = true;
            }

            AnimationLookup = ReadArrayOf <short>(reader, mHeader.OfsAnimLookup, mHeader.NAnimLookup);
            Animations      = ReadArrayOf <AnimationEntry>(reader, mHeader.OfsAnimations, mHeader.NAnimations);

            AnimationIds = Animations.Select(x => x.animationID).ToArray();

            var uvAnims = ReadArrayOf <M2TexAnim>(reader, mHeader.OfsUvAnimation, mHeader.NUvAnimation);

            UvAnimations = uvAnims.Select(uv => new M2UVAnimation(this, ref uv, reader)).ToArray();

            var colorAnims = ReadArrayOf <M2ColorAnim>(reader, mHeader.OfsSubmeshAnimations, mHeader.NSubmeshAnimations);

            ColorAnimations = colorAnims.Select(c => new M2TexColorAnimation(this, ref c, reader)).ToArray();

            var transparencies = ReadArrayOf <AnimationBlock>(reader, mHeader.OfsTransparencies, mHeader.NTransparencies);

            Transparencies = transparencies.Select(t => new M2AlphaAnimation(this, ref t, reader)).ToArray();
        }
Exemplo n.º 23
0
        public void Write(GamePacketWriter writer)
        {
            writer.Write(Id);
            writer.Write(Unknown8, 14);
            writer.WriteStringWide(Name);
            writer.Write(Race, 5);
            writer.Write(Class, 5);
            writer.Write(Sex, 2);
            writer.Write(Unknown20);

            writer.Write((byte)Unknown2C.Count);
            Unknown2C.ForEach(e => writer.Write(e));

            writer.WriteStringWide(Unknown30);
            writer.Write(Unknown34, 4);

            writer.Write((byte)Unknown3C.Count, 5);
            Unknown3C.ForEach(e => writer.Write(e));
            writer.Write(Bones.Count, 6);
            Bones.ForEach(e => writer.Write(e));

            writer.Write(Unknown48, 3);
            writer.Write(Unknown4C);
            writer.Write(Unknown50, 14);
        }
Exemplo n.º 24
0
        public void Write(AssetWriter writer)
        {
            Sprites.Write(writer);
            if (SpriteMetaData.HasOutline(writer.Version))
            {
                Outline.Write(writer);
            }
            if (SpriteMetaData.HasPhysicsShape(writer.Version))
            {
                PhysicsShape.Write(writer);
            }
            if (SpriteMetaData.HasBones(writer.Version))
            {
                Bones.Write(writer);
                writer.Write(SpriteID);
            }
            if (SpriteMetaData.HasInternalID(writer.Version))
            {
                writer.Write(InternalID);
            }
            if (SpriteMetaData.HasBones(writer.Version))
            {
                Vertices.Write(writer);
                Indices.Write(writer);
                Edges.Write(writer);
                writer.AlignStream();

                Weights.Write(writer);
                writer.AlignStream();
            }
            if (HasSecondaryTextures(writer.Version))
            {
                SecondaryTextures.Write(writer);
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// Pre-calculates chrome texture values for the model.
        /// This operation modifies the model vertices.
        /// </summary>
        private void PreCalculateChromeCoordinates()
        {
            var transforms = Bones.Select(x => x.Transform).ToList();

            foreach (var g in GetActiveMeshes().GroupBy(x => x.SkinRef))
            {
                var skin = Textures.FirstOrDefault(x => x.Index == g.Key);
                if (skin == null || (skin.Flags & 0x02) == 0)
                {
                    continue;
                }
                foreach (var v in g.SelectMany(m => m.Vertices))
                {
                    var transform = transforms[v.BoneWeightings.First().Bone.BoneIndex];

                    // Borrowed from HLMV's StudioModel::Chrome function
                    var tmp = transform.Shift.Normalise();

                    // Using unitx for the "player right" vector
                    var up    = tmp.Cross(CoordinateF.UnitX).Normalise();
                    var right = tmp.Cross(up).Normalise();

                    // HLMV is doing an inverse rotate (no translation),
                    // so we set the shift values to zero after inverting
                    var inv = transform.Inverse();
                    inv[12] = inv[13] = inv[14] = 0;
                    up      = up * inv;
                    right   = right * inv;

                    v.TextureU = (v.Normal.Dot(right) + 1) * 32;
                    v.TextureV = (v.Normal.Dot(up) + 1) * 32;
                }
            }
        }
Exemplo n.º 26
0
        public void FinalizeBVHSkeleton()
        {
            for (int k = 0; k < Bones.Count(); k++)
            {
                // set max Depth
                if (Bones[k].Depth > maxDepth)
                {
                    maxDepth = Bones[k].Depth;
                }

                //set Bone Index for Motion Values Array
                int motionCount = 0;
                for (int n = 0; n < k; n++)
                {
                    motionCount += Bones[n].ChannelCount;
                }
                Bones[k].MotionSpace = motionCount;

                //set Count of Channels for Skeleton
                channels += Bones[k].ChannelCount;

                //set Children
                List <BVHBone> childBoneList = Bones.FindAll(i => i.Parent == Bones[k]);
                if (childBoneList.Count == 0)
                {
                    Bones[k].End = true;
                }
                else
                {
                    Bones[k].Children = childBoneList;
                }
            }
        }
Exemplo n.º 27
0
        // PUBLIC METHODS: ------------------------------------------------------------------------

        public static GameObject Wear(GameObject prefab, Character character)
        {
            if (prefab == null || character == null)
            {
                return(null);
            }

            CharacterAnimator animator = character.GetCharacterAnimator();

            if (animator == null || animator.animator == null)
            {
                return(null);
            }

            Transform root  = animator.animator.transform;
            Bones     bones = new Bones(root);

            GameObject garment = GameObject.Instantiate <GameObject>(prefab);

            garment.name = string.Format(GARMENT_NAME, prefab.name);
            SkinnedMeshRenderer[] renderers = garment.GetComponentsInChildren <SkinnedMeshRenderer>();
            Transform             target    = AddAsChild(garment.transform, root);

            for (int i = 0; i < renderers.Length; ++i)
            {
                SkinnedMeshRenderer renderer = AddSkinnedMeshRenderer(renderers[i], target);
                renderer.bones = GetTransforms(renderers[i].bones, bones);
            }

            return(target.gameObject);
        }
        void CreateBoneOverview(GameSkeleton skeleton)
        {
            var boneIndexsUsed = _meshNode.Geometry.GetUniqeBlendIndices();

            Bones.Clear();

            if (skeleton == null)
            {
                return;
            }

            for (int i = 0; i < skeleton.BoneCount; i++)
            {
                var parentBoneId = skeleton.GetParentBone(i);
                if (parentBoneId == -1)
                {
                    Bones.Add(CreateNode(i, parentBoneId, skeleton.BoneNames[i], boneIndexsUsed));
                }
                else
                {
                    var treeParent = GetParent(Bones, parentBoneId);

                    if (treeParent != null)
                    {
                        treeParent.Children.Add(CreateNode(i, parentBoneId, skeleton.BoneNames[i], boneIndexsUsed));
                    }
                }
            }

            Bones = FilterHelper.FilterBoneList("", true, Bones);
        }
        void CreateBoneOverview(GameSkeleton skeleton)
        {
            SelectedBone = null;
            Bones.Clear();
            BoneCount = 0;

            if (skeleton == null)
            {
                return;
            }

            BoneCount = skeleton.BoneCount;
            for (int i = 0; i < skeleton.BoneCount; i++)
            {
                var parentBoneId = skeleton.GetParentBone(i);
                if (parentBoneId == -1)
                {
                    Bones.Add(CreateNode(i, parentBoneId, skeleton.BoneNames[i]));
                }
                else
                {
                    var treeParent = GetParent(Bones, parentBoneId);

                    if (treeParent != null)
                    {
                        treeParent.Children.Add(CreateNode(i, parentBoneId, skeleton.BoneNames[i]));
                    }
                }
            }
        }
Exemplo n.º 30
0
        private async void RemoveExecute()
        {
            Int64 startTicks = Log.VIEWMODEL("(BoneDetailViewModel) Enter", Common.LOG_APPNAME);

            var isReferenced =
                await _BoneDataService.IsReferencedByDogAsync(SelectedBone.Id);

            if (isReferenced)
            {
                //MessageDialogService.ShowInfoDialog(
                //    $"The Dog ({SelectedBone.Name})" +
                //    " can't be removed;  It is referenced by at least one Dog");

                var message = $"The Dog ({SelectedBone.Name})" +
                              " can't be removed;  It is referenced by at least one Dog";

                DialogService.Show("NotificationDialog", new DialogParameters($"message={message}"), r =>
                {
                });

                return;
            }

            SelectedBone.PropertyChanged -= Wrapper_PropertyChanged;
            _BoneDataService.Remove(SelectedBone.Model);
            Bones.Remove(SelectedBone);
            SelectedBone = null;
            HasChanges   = _BoneDataService.HasChanges();

            ((DelegateCommand)SaveCommand).RaiseCanExecuteChanged();

            Log.VIEWMODEL("(BoneDetailViewModel) Exit", Common.LOG_APPNAME, startTicks);
        }
Exemplo n.º 31
0
 public Vector3 GetBoneVector(Bones bone)
 {
     if (IsValid())
         return new Vector3(
             CSGOData.Memory.Read<float>((IntPtr)GetBoneAddress((int)bone) +0x0c),
             CSGOData.Memory.Read<float>((IntPtr)GetBoneAddress((int)bone) + 0x1C),
             CSGOData.Memory.Read<float>((IntPtr)GetBoneAddress((int)bone) + 0x2C)
             );
     else return Vector3.Zero;
 }