예제 #1
0
        public void LoadContent(ContentManager content, string girl)
        {
            string      pJson = File.ReadAllText("Content/Descriptors/Objects/Player/" + girl + ".json");
            _PlayerInfo pInfo = JsonConvert.DeserializeObject <_PlayerInfo>(pJson);

            mName  = pInfo.Name;
            mSpeed = pInfo.Speed;

            //Copy over sequences into map
            foreach (var seq in pInfo.Sequences)
            {
                SpriteSequence s = new SpriteSequence();
                s.mSequence = seq.Seq;
                s.Looping   = seq.Looping;
                s.mSubLoop  = seq.SubLoop;
                mSequenceMap.Add(seq.Key, s);
            }

            //Load the Atlas
            string     aJson = File.ReadAllText("Content/Descriptors/Images/Player/" + pInfo.Atlas);
            _AtlasInfo aInfo = JsonConvert.DeserializeObject <_AtlasInfo>(aJson);

            Texture2D image = content.Load <Texture2D>("Images/Player/" + aInfo.Image);

            Dictionary <String, List <Rectangle> > setMap = new Dictionary <String, List <Rectangle> >();

            foreach (var set in aInfo.ClipSets)
            {
                List <Rectangle> clips = new List <Rectangle>();
                foreach (var clip in set.Set)
                {
                    clips.Add(new Rectangle(clip[0], clip[1], clip[2], clip[3]));
                }
                setMap.Add(set.Key, clips);
            }
            mPlayerAtlas = new TextureAtlas(image, setMap);
        }
예제 #2
0
 public void SetTextureAtlas(TextureAtlas atlas)
 {
     mEnemyAtlas = atlas; debugTexture = mEnemyAtlas.GenerateDebugTexture(Color.White);
 }