Exemple #1
0
        public static Animation[] LoadAnims(ContentManager content)
        {
            StreamReader sr;
            BasePath = content.RootDirectory;
            sr = new StreamReader(BasePath + "/world/animations/animList.txt");
            int i_numAnim = Convert.ToInt32(sr.ReadLine());

            Animation[] ani_out = new Animation[i_numAnim];

            for (int i = 0; i != i_numAnim; i++)
            {
                string name =sr.ReadLine();
                StreamReader sr1 = new StreamReader(BasePath + "/world/animations/" + name + ".anim");
                ani_out[i].f_frame = new frame[Convert.ToInt32(sr1.ReadLine())];
                ani_out[i].name = name;
                for (int k = 0; k != ani_out[i].f_frame.Length; k++)
                {
                    int components = Convert.ToInt32(sr1.ReadLine());
                    ani_out[i].f_frame[k].angle = new float[components];
                    ani_out[i].f_frame[k].position = new Vector2[components];

                    for (int j = 0; j != components; j++)
                    {
                        ani_out[i].f_frame[k].angle[j] = Convert.ToSingle(sr1.ReadLine());
                        ani_out[i].f_frame[k].position[j].X = Convert.ToSingle(sr1.ReadLine());
                        ani_out[i].f_frame[k].position[j].Y = Convert.ToSingle(sr1.ReadLine());
                        ani_out[i].f_frame[k].key_frame = Convert.ToBoolean(sr1.ReadLine());
                    }

                }
                sr1.Close();
            }
            sr.Close();

            return ani_out;
        }
Exemple #2
0
 public character(string Name, Vector2 Position, skill Skill, ControlType CType, CharType type)
 {
     controlType = CType;
     action = "idle";
     special_tag = -1;
     Type = type;
     name = Name;
     B_baseProps = new Base(Position, 70f);
     f_currentFrame = 0;
     body = null;
     currentAnim = new Animation();
     angle = 0;
     accuracy = 1;
     attrib = Skill;
     armor = 0;
     pointingRight = true;
     Primary_weap = Secondary_weap = SideArm_weap = current_weap = new weapon();
     Inventory = new inventory(5, null);
     weaponInUse = "unarmed";
     brain = new AInode(false);
     reordered = false;
 }