Пример #1
0
		internal List<BackgroundLayer> DeserializeBackgroundLayers(JArray layers, Camera2D ownerCamera, BoundingRectangle ownerBounds)
		{
			List<BackgroundLayer> result = new List<BackgroundLayer>(layers.Count);

			foreach (var layerData in layers)
			{
				BackgroundLayer layer = new BackgroundLayer(ownerCamera, ownerBounds);

				string resourceName = (string)layerData["resourceName"];
				BackgroundScrollDirection direction = (BackgroundScrollDirection)(int)layerData["scrollDirection"];
				float scrollRate = (float)layerData["scrollRate"];

				layer.BackgroundTextureResourceName = resourceName;
				layer.ScrollDirection = direction;
				layer.ScrollRate = scrollRate;

				result.Add(layer);
			}

			return result;
		}
Пример #2
0
 /// <summary>
 ///   Initializes a new instance of the <see cref="BackgroundLayer" /> class.
 /// </summary>
 /// <param name="ownerCamera">
 ///   The camera of the section that contains this layer.
 /// </param>
 /// <param name="sectionBounds">
 ///   The bounds of the section that contains this layer.
 /// </param>
 public BackgroundLayer(Camera2D ownerCamera, BoundingRectangle sectionBounds)
 {
     camera = ownerCamera;
     this.sectionBounds = sectionBounds;
 }