public void TestCompositeWithTransform()
        {
            var source = new RectangleInt(10, 10, 20, 20);
            var origin = new Vector(4, 7);

            // ARRANGE
            var spriteSheet = new SpriteSheet(null, "toto");
            var definition = spriteSheet.AddSpriteDefinition("toto", source, origin);
            var transform = new SpriteTransform(translation: new Vector(43, -27), rotation: -1.2f, scale: 5.0f, color: Color.Yellow);
            var template = spriteSheet.AddSpriteCompositeTemplate("tata")
                .AddTemplate(definition, transform);

            var expectedSprite = new Sprite(spriteSheet, "toto")
            {
                Position = new Vector(43, -27),
                Rotation = -1.2f,
                Scale = 5.0f,
                Color = Color.Yellow
            };

            var expected = new SpriteComposite("tata", new[] { expectedSprite });

            // ACT
            var actual = (SpriteComposite)template.CreateInstance();

            // ASSERT
            AssertSprite.CompositeEqual(expected, actual);
        }
        public void TestDefaultValueForEmptyComposite()
        {
            var expected = new SpriteComposite("tata", Enumerable.Empty<SpriteBase>());

            // ARRANGE
            var spriteSheet = new SpriteSheet(null, "toto");
            var template = spriteSheet.AddSpriteCompositeTemplate("tata");

            // ACT
            var actual = (SpriteComposite)template.CreateInstance();

            // ASSERT
            AssertSprite.CompositeEqual(expected, actual);
        }
        public void TestComposite()
        {
            var source = new RectangleInt(10, 10, 20, 20);
            var origin = new Vector(4, 7);

            // ARRANGE
            var spriteSheet = new SpriteSheet(null, "toto");
            var definition = spriteSheet.AddSpriteDefinition("toto", source, origin);
            var template = spriteSheet.AddSpriteCompositeTemplate("tata")
                .AddTemplate(definition);

            var expectedSprite = new Sprite(spriteSheet, "toto");
            var expected = new SpriteComposite("tata", new[] { expectedSprite });

            // ACT
            var actual = (SpriteComposite)template.CreateInstance();

            // ASSERT
            AssertSprite.CompositeEqual(expected, actual);
        }
        private SpriteLayer CreateSpriteLayer()
        {
            var texture = this.ResourceManager.GetTexture(@"Sandbox\LinkSheet");
            var sheet = new SpriteSheet(texture, "Link");
            sheet.AddSpriteDefinition("Link01", new RectangleInt(3, 3, 16, 22), new Vector(8, 11));
            sheet.AddSpriteDefinition("Sleep01", new RectangleInt(45, 219, 32, 40));

            var la1 = sheet.AddSpriteDefinition("LinkAnim01", new RectangleInt(187, 270, 28, 28), new Vector(07, 25));
            var la2 = sheet.AddSpriteDefinition("LinkAnim02", new RectangleInt(225, 273, 31, 22), new Vector(07, 19));
            var la3 = sheet.AddSpriteDefinition("LinkAnim03", new RectangleInt(268, 270, 26, 28), new Vector(06, 19));
            var la4 = sheet.AddSpriteDefinition("LinkAnim04", new RectangleInt(303, 266, 17, 35), new Vector(06, 19));
            var la5 = sheet.AddSpriteDefinition("LinkAnim05", new RectangleInt(328, 269, 26, 30), new Vector(17, 19));
            var la6 = sheet.AddSpriteDefinition("LinkAnim06", new RectangleInt(355, 273, 32, 22), new Vector(23, 19));
            var la7 = sheet.AddSpriteDefinition("LinkAnim07", new RectangleInt(389, 271, 24, 25), new Vector(16, 22));
            var la8 = sheet.AddSpriteDefinition("LinkAnim08", new RectangleInt(423, 268, 16, 31), new Vector(08, 28));

            //var linkAnimTemplate = new SpriteAnimationTemplate("LinkAnim")
            var linkAnimTemplate = sheet.AddSpriteAnimationTemplate("LinkAnim")
                .AddFrame(la1, 0.1f)
                .AddFrame(la2, 0.1f)
                .AddFrame(la3, 0.1f)
                .AddFrame(la4, 0.1f)
                .AddFrame(la5, 0.1f)
                .AddFrame(la6, 0.1f)
                .AddFrame(la7, 0.1f)
                .AddFrame(la8, 0.1f);

            var crystal = sheet.AddSpriteDefinition("Crystal", new RectangleInt(336, 221, 10, 14), new Vector(4, 6));

            //this.linkCompositeTemplate = new SpriteCompositeTemplate("CompositeLink")
            this.linkCompositeTemplate = sheet.AddSpriteCompositeTemplate("CompositeLink")
                .AddTemplate(linkAnimTemplate)
                .AddTemplate(crystal, new SpriteTransform(translation: new Vector(20, 0)));

            //sheet.Save(@"C:\Users\Pascal\Dev\DotNet\GitHub\XNAGameEngine2D\Link SpriteSheet.xml");

            var link01 = new Sprite(sheet, "Link01") { Position = this.player, Color = Color.Blue, Scale = 2, ShouldDrawPixelPrecision = true };
            this.sleep01 = new Sprite(sheet, "Sleep01") { Position = new Vector(125, 25), FlipVertically = true };

            this.ResourceManager.AddSpriteSheet(sheet);

            var spriteLayer = new SpriteLayer("Sprites");
            spriteLayer.AddSprite(link01);
            spriteLayer.AddSprite(this.sleep01);
            spriteLayer.ParallaxScrollingVector = new Vector(4.0f, 8.0f);
            spriteLayer.Offset = new Vector(50, 50);

            return spriteLayer;
        }