Esempio n. 1
0
 public void Initialize(CharacterDefinition.PicDef pd)
 {
     Texture2D tex = GameConst.Content.Load<Texture2D>(@"character/" + pd.texture);
     framesize.X = pd.width;
     framesize.Y = pd.height;
     Size = new Vector2(pd.size, pd.size);
     foreach (CharacterDefinition.AnimDef ad in pd.anims)
     {
         CharacterAnimation cani = new CharacterAnimation(ad.name);
         cani.FrameCount = ad.framecount;
         cani.EventFrame = ad.eventframe;
         cani.Loop = ad.loop;
         cani.Speed = ad.speed;
         foreach (CharacterDefinition.AnimFrameDef fd in ad.frames)
         {
             cani.AddFrame(fd.x, fd.y, fd.w, fd.h, fd.center);
             cani.Reset();
         }
         Animations[ad.name] = cani;
         animTextures[ad.name] = tex;
     }
     currentAnim = Animations["Idle"];
 }
Esempio n. 2
0
        public void Initialize(ContentManager content)
        {
            string assertname = "effect/" + name;

            animation = new CharacterAnimation(name);
            PreRenderEffectContent.FrameDef[] defs = content.Load<PreRenderEffectContent.FrameDef[]>(assertname);
            animation.FrameCount = defs.Length;
            animation.Speed = playspeed;
            foreach (PreRenderEffectContent.FrameDef def in defs)
            {
                animation.AddFrame(def.x, def.y, def.w, def.h, "center");
            }
            animation.Reset();

            assertname = "effect/" + name + "_pic";
            texture = content.Load<Texture2D>(assertname);
        }
Esempio n. 3
0
 public void AddCharacterDefinition(CharacterDefinition.PicDef pd)
 {
     Texture2D tex = GameConst.Content.Load<Texture2D>(@"character/" + pd.texture);
     if (tex != null)
     {
         foreach (CharacterDefinition.AnimDef ad in pd.anims)
         {
             CharacterAnimation cani = new CharacterAnimation(ad.name);
             cani.FrameCount = ad.framecount;
             cani.EventFrame = ad.eventframe;
             cani.Loop = ad.loop;
             cani.Speed = ad.speed;
             foreach (CharacterDefinition.AnimFrameDef fd in ad.frames)
             {
                 cani.AddFrame(fd.x, fd.y, fd.w, fd.h, fd.center);
                 cani.Reset();
             }
             Animations[ad.name] = cani;
             animTextures[ad.name] = tex;
         }
     }
 }