public AnimationHelper(AnimationHelper animation)
 {
     leftImages = (LTexture[])CollectionUtils.CopyOf(animation.leftImages);
     downImages = (LTexture[])CollectionUtils.CopyOf(animation.downImages);
     upImages = (LTexture[])CollectionUtils.CopyOf(animation.upImages);
     rightImages = (LTexture[])CollectionUtils
             .CopyOf(animation.rightImages);
 }
Beispiel #2
0
        public static AnimationHelper MakeObject(string fileName, int row, int col,
                                                 int tileWidth, int tileHeight)
        {
            string          key       = fileName.Trim().ToLower();
            AnimationHelper animation = (AnimationHelper)CollectionUtils.Get(animations, key);

            if (animation == null)
            {
                LTexture[][] images = TextureUtils.GetSplit2Textures(fileName,
                                                                     tileWidth, tileHeight);
                LTexture[][] result = (LTexture[][])CollectionUtils.XNA_CreateJaggedArray(typeof(LTexture), row, col);
                for (int y = 0; y < col; y++)
                {
                    for (int x = 0; x < row; x++)
                    {
                        result[x][y] = images[y][x];
                    }
                }
                images = null;
                CollectionUtils.Put(animations, key, animation = MakeObject(result[0], result[1], result[2],
                                                                            result[3]));
            }
            return(animation);
        }
 public static AnimationHelper MakeObject(LTexture[] down,
         LTexture[] left, LTexture[] right, LTexture[] up)
 {
     AnimationHelper animation = new AnimationHelper();
     animation.downImages = down;
     animation.leftImages = left;
     animation.rightImages = right;
     animation.upImages = up;
     return animation;
 }