Example #1
0
 public WASDAnimationImporter(SingleAnimationImporter w, SingleAnimationImporter a, SingleAnimationImporter s, SingleAnimationImporter d)
 {
     _w_importer = w;
     _a_importer = a;
     _s_importer = s;
     _d_importer = d;
 }
        public AnimationDNABlock BuildAnimation(SingleAnimationImporter animationDefinition, string spritesheetKey, string direction)
        {
            string animationKey = spritesheetKey + "_" + animationDefinition.TagName;

            // fetch all frames for an model/action/direction into a list
            List <Sprite> spriteList = new List <Sprite>();

            for (int i = 0; i < animationDefinition.NumberOfFrames; i++)
            {
                string spriteKey = animationKey + "_" + i;
                Sprite sprite    = AtlasManager.GetSprite(spriteKey);
                spriteList.Add(sprite);
            }

            // get the model key from the animation key
            string modelKey     = animationKey.Split('_')[0].ToUpper();
            int    sortingOrder = DNABlockType.GetSortingOrder(modelKey, direction);

            // create a new animation block
            return(new AnimationDNABlock(animationKey, spriteList, direction, sortingOrder));
        }