Ejemplo n.º 1
0
        /// <summary>
        /// This function is called to load content into this component
        /// of our game.
        /// </summary>
        /// <param name="content">The content manager to load from.</param>
        public void LoadContent(ContentManager content)
        {
            // Load the second model
            model = content.Load<Model>(asset);

            // Save off all of hte bone information
            int boneCnt = model.Bones.Count;
            bindTransforms = new Matrix[boneCnt];
            boneTransforms = new Matrix[boneCnt];

            model.CopyBoneTransformsTo(bindTransforms);
            model.CopyBoneTransformsTo(boneTransforms);

            // Find all of the doors and save the index for the bone
            for (int b = 0; b < boneCnt; b++)
            {
                if (model.Bones[b].Name.StartsWith("DoorInner") || model.Bones[b].Name.StartsWith("DoorOuter"))
                {
                    //Create and initialize doors
                    Door thisDoor = new Door();
                    thisDoor.boneNum = b;
                    thisDoor.boneName = model.Bones[b].Name;
                    thisDoor.doorState = Door.DoorState.DoorClosed;
                    switch(thisDoor.boneName.Substring(9,thisDoor.boneName.Length-9))
                    {
                        case "1":
                            thisDoor.location=new Vector3(218,0,1023);
                            break;
                        case "2":
                            thisDoor.location=new Vector3(-11,0,-769);
                            break;
                        case "3":
                            thisDoor.location=new Vector3(587,0,-999);
                            break;
                        case "4":
                            thisDoor.location=new Vector3(787,0,-763);
                            break;
                        case "5":
                            thisDoor.location=new Vector3(1187,0,-1218);
                            break;
                    }
                    doors.Add(thisDoor);
                }
            }
        }
Ejemplo n.º 2
0
 private float GetOpenDoorDegree(Door door)
 {
     return boneTransforms[door.boneNum].Translation.Y/200;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// This function is called to load content into this component
        /// of our game.
        /// </summary>
        /// <param name="content">The content manager to load from.</param>
        public void LoadContent(ContentManager content)
        {
            // Load the second model
            model = content.Load<Model>(asset);

            // Save off all of hte bone information
            int boneCnt = model.Bones.Count;
            bindTransforms = new Matrix[boneCnt];
            boneTransforms = new Matrix[boneCnt];

            model.CopyBoneTransformsTo(bindTransforms);
            model.CopyBoneTransformsTo(boneTransforms);

            // Find all of the doors
            for (int b = 0; b < boneCnt; b++)
            {
                if (model.Bones[b].Name.StartsWith("DoorInner") || model.Bones[b].Name.StartsWith("DoorOuter"))
                {
                    // What is the door number?
                    int dnum = int.Parse(model.Bones[b].Name.Substring(9));

                    // Add to a dictionary that converts door numbers to bone indices
                    doors[dnum] = new Door();
                    doors[dnum].Bone = b;
                }

            }
        }