Example #1
0
        /// <summary>
        /// Add layer, set parallax factor for it and add a list of sprites to the layer
        /// </summary>
        /// <param name="sprites">List of sprites to be added to the layer</param>
        /// <param name="parallax">Parallax factor for this layer</param>
        /// <returns>Return the layer which was added to this Background system</returns>
        public BackgroundLayer AddLayer(List <Sprite> sprites, Vector2 parallax)
        {
            BackgroundLayer layer = new BackgroundLayer(Camera, parallax);

            foreach (Sprite s in sprites)
            {
                layer.AddSprite(s);
            }
            layers.Add(layer);
            return(layer);
        }
Example #2
0
        /// <summary>
        /// Add layer, set parallax factor for it and add one Sprites to the layer
        /// </summary>
        /// <param name="sprite">Sprite to be added to the layer</param>
        /// <param name="parallax">Parallax factor for this layer</param>
        /// <returns>Return the layer which was added to this Background system</returns>
        public BackgroundLayer AddLayer(Sprite sprite, Vector2 parallax)
        {
            BackgroundLayer layer = new BackgroundLayer(Camera, parallax);

            layers.Add(layer);
            if (sprite != null)
            {
                layer.AddSprite(sprite);
            }
            return(layer);
        }