예제 #1
0
        /// <summary>
        /// Constructor for the animation player. It makes the 
        /// association between a clip and a model and sets up for playing
        /// </summary>
        /// <param name="clip"></param>
        public AnimationPlayer(AnimationClip clip, AnimatedModel model)
        {
            this.clip = clip;
            this.model = model;

            // Create the bone information classes
            boneCnt = clip.Bones.Count;
            boneInfos = new BoneInfo[boneCnt];

            for (int b = 0; b < boneInfos.Length; b++)
            {
                // Create it
                boneInfos[b] = new BoneInfo(clip.Bones[b]);

                // Assign it to a model bone
                boneInfos[b].SetModel(model);
            }

            Rewind();
        }
예제 #2
0
        public void loadCombatant(ContentManager content,string combatDef,PlayerIndex player)
        {
            this.player = player;
            BFFileReader reader = new BFFileReader(combatDef);
            List<Texture2D> textures = new List<Texture2D>();
            reader.Open();
            string line = "";
            #region Combatant parser
            while ((line = reader.ReadLine()) != null)
            {
                string[] param = line.Split(' ');
                switch(param[0])
                {
                    case "ModelID":
                        {
                            ModelID = param[1];
                            break;
                        }
                    case "HalfWidth":
                        {
                            HalfWidth = float.Parse(param[1]);
                            break;
                        }
                    case "HalfHeight":
                        {
                            HalfHeight = float.Parse(param[1]);
                            break;
                        }
                    case "HalfLength":
                        {
                            HalfLength = float.Parse(param[1]);
                            break;
                        }
                    case "Radius":
                        {
                            Radius = float.Parse(param[1]);
                            break;
                        }
                    case "TransX":
                        {
                            TransX = float.Parse(param[1]);
                            break;
                        }
                    case "TransY":
                        {
                            TransY = float.Parse(param[1]);
                            break;
                        }
                    case "TransZ":
                        {
                            TransZ = float.Parse(param[1]);
                            break;
                        }
                    case "Texture":
                        {
                            textures.Add(content.Load<Texture2D>(param[1]));
                            break;
                        }
                    case "CollideType":
                        {
                            switch (param[1].ToUpper())
                            {
                                case "AABB":
                                    {
                                        ORIGEN = new AABB();
                                        CollisionType = Origen.Collision_Type.AABB;

                                        break;
                                    }
                                case "NONE":
                                    {
                                        CollisionType = Origen.Collision_Type.NONE;
                                        break;
                                    }
                                case "BC":
                                    {
                                        ORIGEN = new BC();
                                        CollisionType = Origen.Collision_Type.BC;
                                        break;
                                    }
                                case "BS":
                                    {
                                        ORIGEN = new BS();
                                        CollisionType = Origen.Collision_Type.BS;
                                        break;
                                    }
                            }
                            break;
                        }

                }
            }
            #endregion
            reader.Close();
            model = new AnimatedModel(ModelID);
            model.LoadContent(content);
            //load the textures for the model
            model.textures = textures.ToArray();
            //play an animation
            model.PlayAnimation("TakePunchLeft", false);
            RotX -= (float)Math.PI/2;
        }
예제 #3
0
 /// <summary>
 /// Assign this bone to the correct bone in the model
 /// </summary>
 /// <param name="model"></param>
 public void SetModel(AnimatedModel model)
 {
     // Find this bone
     assignedBone = model.FindBone(ClipBone.Name);
 }
 public void loadCombatants(string address,ContentManager content)
 {
     BFFileReader reader = new BFFileReader(address);
     reader.Open();
     string line;
     while((line = reader.ReadLine()) != null)
     {
         string dataName = "";
         string[] param1 = line.Split(' ');
         List<Texture2D> textures = new List<Texture2D>();
         BFFileReader reader2 = new BFFileReader("Files/Combatants/" + param1[1] + ".txt");
         reader2.Open();
         string line2;
         while ((line2 = reader2.ReadLine()) != null)
         {
             string[] param = line2.Split(' ');
             if(param[0] == "Texture")
             {
                 textures.Add(content.Load<Texture2D>(param[1]));
             }
             else
             if(param[0] == "ModelID")
             {
                 dataName = param[1];
             }
         }
         CharacterInfo info = new CharacterInfo();
         AnimatedModel model = new AnimatedModel(dataName);
         string name = param1[0];
         string modelName = param1[1];
         info.model = model;
         info.model.LoadContent(content);
         info.name = name;
         info.modelName = modelName;
         info.model.textures = textures.ToArray();
         combatants.AddLast(info);
         reader2.Close();
         numOfPlayers = parent.NumOfPlayers;
     }
     font = content.Load<SpriteFont>("Font");
     //play all of the animations on the models
     foreach(CharacterInfo info in combatants)
     {
         info.model.PlayAnimation("WalkFight", true);
     }
     data = combatants.First;
     reader.Close();
     wallTexture = content.Load<Texture2D>("walls");
     Texture2D start, cancel;
     start = content.Load<Texture2D>("Start");
     cancel = content.Load<Texture2D>("Exit");
     menu = new Menu(4, new Rectangle(parent.ScreenWidth / 2 - (start.Width / 2), parent.ScreenHeight / 2, start.Width, start.Height), start, cancel);
 }